This patch changes SPUpdate (stack pointer update) instruction position in prologue and epilogue, in order to create more reorder chances for scheduler. Concept as below example:
Current This Patch prologue: mflr 0 stdu 1, -240(1) mfcr 12 .. std 0, 16(1) (scheduler gets more reorder chances) stw 12, 8(1) stdu 1, -240(1) epilogue: addi 1, 1, 240 (scheduler gets more reorder chances) ld 0, 16(1) lwz 12, 8(1) mtocrf 32, 12 mtlr 0 addi 1, 1, 240 blr blr
It moves SPUpdate to the beginning of prologue, and to the end (before return) of epilogue, so it can create more chances for scheduler to reorder mflr/mfcr/lr store/cr store, as well as mtlr/mtocrf/lr load/cr load.
Original issue: https://llvm.org/bugs/show_bug.cgi?id=25685
Sorry, after re-run SPEC2006 test, I found the performance was not improved.