This is an archive of the discontinued LLVM Phabricator instance.

[ppc64] Create instruction reorder chances in prologue and epilogue for post-RA-scheduler
AbandonedPublic

Authored by cycheng on Mar 10 2016, 1:02 AM.

Details

Summary

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.

Diff Detail

Event Timeline

cycheng updated this revision to Diff 50246.Mar 10 2016, 1:02 AM
cycheng retitled this revision from to [ppc64] Create instruction reorder chances in prologue and epilogue for post-RA-scheduler.
cycheng updated this object.
cycheng added a subscriber: llvm-commits.
cycheng updated this object.Mar 10 2016, 1:02 AM
cycheng updated this object.Apr 6 2016, 4:39 AM
kbarton edited edge metadata.Apr 6 2016, 8:59 AM

Do we still want to pursue this given it did not fix the reported problem?
In general, I think this is a good thing to do, but I also agree it can have limited benefits. I'm not sure the added complexity is worth it, especially since it has no impact on the original problem.

cycheng planned changes to this revision.Apr 6 2016, 6:31 PM

No, please stop reviewing this patch.

We need discussion for the next step. I'm afraid our effort in prologue/epilogue instruction scheduling is not helpful to power8 and such kind of advanced out-of-order cpu :(

cycheng abandoned this revision.May 18 2016, 5:30 PM

Abandon this patch since prologue/epilogue instruction order is not a major performance issue.