This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] enable optimizeCompareInstr for branch with static branch hint
ClosedPublic

Authored by inouehrs on Jul 24 2017, 8:43 AM.

Details

Summary

In optimizeCompareInstr, a compare instruction is eliminated by using a record form instruction if possible.
If the branch instruction that uses the result of the compare has a static branch hint, the optimization does not happen.
This patch makes this optimization happen regardless of the branch hint by splitting branch hint and branch condition before checking the predicate to identify the possible optimizations.

Diff Detail

Repository
rL LLVM

Event Timeline

inouehrs created this revision.Jul 24 2017, 8:43 AM
nemanjai accepted this revision.Jul 25 2017, 3:39 AM

Just a couple of minor nits to add comments aiding readability. Other than that, LGTM.

lib/Target/PowerPC/PPCInstrInfo.cpp
1644 ↗(On Diff #107906)

// Ignore hint bits when checking for non-equality comparisons.

1693 ↗(On Diff #107906)

Please add a note that the existing hint is propagated to the updated hint (or something along those lines). I think that it isn't immediately obvious to the reader what is happening here.

This revision is now accepted and ready to land.Jul 25 2017, 3:39 AM
This revision was automatically updated to reflect the committed changes.