https://bugs.llvm.org/show_bug.cgi?id=38848
Bug ID: 38848
Summary: Redundant copy of register when compiling for arm64
Product: new-bugs
Version: 7.0
Hardware: Other
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedb...@nondot.org
Reporter: hiradi...@msn.com
CC: llvm-bugs@lists.llvm.org
$ cat test.cpp
struct BigStruct {
int x[64];
};
void structByValue(BigStruct s);
void callStructByValue(int unused, int unused2, BigStruct s) {
structByValue(s);
}
$ ./bin/clang++ -O3 -arch arm64 redundant-reg.cpp -S -o -
.section __TEXT,__text,regular,pure_instructions
.ios_version_min 5, 0
.globl __Z17callStructByValueii9BigStruct ; -- Begin function
_Z17callStructByValueii9BigStruct
.p2align 2
__Z17callStructByValueii9BigStruct: ; @_Z17callStructByValueii9BigStruct
.cfi_startproc
; %bb.0: ; %entry
sub sp, sp, #288 ; =288
stp x28, x27, [sp, #256] ; 8-byte Folded Spill
stp x29, x30, [sp, #272] ; 8-byte Folded Spill
add x29, sp, #272 ; =272
.cfi_def_cfa w29, 16
.cfi_offset w30, -8
.cfi_offset w29, -16
.cfi_offset w27, -24
.cfi_offset w28, -32
mov x8, x2 <<<<------------------- Copy
mov x0, sp
orr w2, wzr, #0x100
mov x1, x8 <<<<------------------- Copy
bl _memcpy
mov x0, sp
bl __Z13structByValue9BigStruct
ldp x29, x30, [sp, #272] ; 8-byte Folded Reload
ldp x28, x27, [sp, #256] ; 8-byte Folded Reload
add sp, sp, #288 ; =288
ret
.cfi_endproc
; -- End function
.subsections_via_symbols
We could just do 'mov x1, x2' instead of two copies.
--
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