http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50467
Bug #: 50467 Summary: Compiler can move stack cleanup before last memory reference involving the stack Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: meiss...@gcc.gnu.org Host: powerpc64-linux Target: powerpc64-linux Build: powerpc64-linux In looking at the 462.libquantum spec 2006 benchmark, we noticed that the addi used to undo the stack frame before the return is done can be moved above memory operations involving the stack. In the example we noticed (specrand.c), it was using a convert 32-bit integer to floating point sequence. On all powerpc processors except for power6x, this conversion involves doing a store to the stack and a reload into the FPR, since there is no move GPR to FPR instruction. However, the LFIWAX and LFIWZX instructions do not have a reg+offset form, and only support reg+reg. The Altivec and VSX vector instructions are similar in only having reg+reg forms. The address that is used to reference the stack does not have the stack pointer in it, so the scheduler thinks there is no conflict in moving it up.