https://bugs.llvm.org/show_bug.cgi?id=36491
Bug ID: 36491
Summary: Undesirable rematerialization of stack address
computation
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: AArch64
Assignee: unassignedb...@nondot.org
Reporter: eugeni.stepa...@gmail.com
CC: llvm-bugs@lists.llvm.org
$ cat 1.c
void use(void *);
void *p;
void f() {
int x;
p = &x;
use(&x);
}
$ bin/clang 1.c -target aarch64-linux-android -O3 -fomit-frame-pointer -c &&
bin/llvm-objdump -d -r 1.o
0: fe 0f 1f f8 str x30, [sp, #-16]!
4: 08 00 00 90 adrp x8, #0
0000000000000004: R_AARCH64_ADR_PREL_PG_HI21 p
8: e9 33 00 91 add x9, sp, #12
c: e0 33 00 91 add x0, sp, #12
10: 09 01 00 f9 str x9, [x8]
0000000000000010: R_AARCH64_LDST64_ABS_LO12_NC p
14: 00 00 00 94 bl #0
0000000000000014: R_AARCH64_CALL26 use
18: fe 07 41 f8 ldr x30, [sp], #16
1c: c0 03 5f d6 ret
Here x0 and x9 could be merged, but RegisterCoalescer would never consider
merging into a physical register. Instead it remats ADDXri %stack.0.x, 0, 0.
This is specific to AArch64 backend. The same does not happen on X86 because
ADDXri is asCheapAsAMove, while LEA is not.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs