Consider this test case:
typedef struct teststruct
{
double d;
char f1;
int arr[15];
} teststruct;
void
copystruct5 (teststruct param)
{
return;
}
The mighty copystruct5 function does absolutely nothing, so I expect this to be
compiled to absolutely nothing. But not so with r162374 at -O2:
.file "t.c"
.pred.safe_across_calls p1-p5,p16-p63
.text
.align 16
.align 64
.global copystruct5#
.type copystruct5#, @function
.proc copystruct5#
copystruct5:
.prologue
.spill 48
.mmi
.fframe 48
adds r12 = -48, r12
[.L2:]
.body
;;
mov r14 = r12
adds r15 = 16, r12
;;
.mmi
st8 [r14] = r32, 8
st8 [r15] = r34
nop 0
;;
.mmi
st8 [r14] = r33
nop 0
adds r14 = 24, r12
;;
.mmi
st8 [r14] = r35
nop 0
adds r14 = 32, r12
;;
.mmi
st8 [r14] = r36
nop 0
adds r14 = 40, r12
;;
.mmi
st8 [r14] = r37
nop 0
adds r14 = 48, r12
;;
.mmi
st8 [r14] = r38
nop 0
adds r14 = 56, r12
;;
.mib
st8 [r14] = r39
.restore sp
adds r12 = 48, r12
br.ret.sptk.many b0
.endp copystruct5#
.ident "GCC: (GNU) 4.6.0 20100721 (experimental) [trunk revision
162374]"
What's that?!
--
Summary: Empty function compiles to many loads and stores
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: steven at gcc dot gnu dot org
GCC target triplet: ia64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45026