This is an archive of the discontinued LLVM Phabricator instance.

Add Branch Hints for Highly Biased Branches on PPC
ClosedPublic

Authored by tjablin on Nov 19 2015, 5:07 PM.

Details

Reviewers
kbarton
hfinkel
Summary

This branch adds hints for highly biased branches on the PPC architecture. Even in absence of profiling information, LLVM will mark code reaching unreachable terminators and other exceptional control flow constructs as highly unlikely to be reached.

Diff Detail

Event Timeline

tjablin updated this revision to Diff 40721.Nov 19 2015, 5:07 PM
tjablin retitled this revision from to Add Branch Hints for Highly Biased Branches on PPC.
tjablin updated this object.
tjablin added reviewers: kbarton, hfinkel.
tjablin added a subscriber: llvm-commits.
hfinkel edited edge metadata.Nov 23 2015, 5:00 PM

Looks like PPCInstrInfo::SubsumesPredicate also needs to be updated, as does PPCInstrInfo::optimizeCompareInstr (to ignore the hinting bits).

lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h
60

Use an enum for these.

lib/Target/PowerPC/PPCISelDAGToDAG.cpp
59

These appear in a command-line -help-hidden list, and this description is uncharacteristically long. Shorten this. "Enable static hinting of branches on ppc" is fine, for example.

Feel free to include a more-verbose description in a comment.

2453

PCC |= (TWeight > FWeight) ? PPC::PRED_TAKEN_HINT : PCC |= PPC::PRED_NOT_TAKEN_HINT;

2901–2905

Should you do something here too?

lib/Target/PowerPC/PPCInstrInfo.cpp
713 ↗(On Diff #40721)

This might be good for POWER cores, but not for the A2. At least, don't do this when targeting the A2.

tjablin updated this revision to Diff 42023.Dec 6 2015, 4:52 PM
tjablin edited edge metadata.
hfinkel accepted this revision.Dec 10 2015, 5:37 AM
hfinkel edited edge metadata.

Please remember to upload your patches with full context (http://llvm.org/docs/Phabricator.html#requesting-a-review-via-the-web-interface).

A few minor comments, otherwise LGTM.

lib/Target/PowerPC/PPCISelDAGToDAG.cpp
39

Please don't make unrelated white-space changes along with functional changes.

58

Is there further testing you wish to do before enabling this by default? If not, then let's enable it.

This revision is now accepted and ready to land.Dec 10 2015, 5:37 AM
tjablin updated this revision to Diff 42587.Dec 11 2015, 2:41 PM
tjablin edited edge metadata.

Enable by default. Remove accidental whitespace additions.

hfinkel closed this revision.Dec 11 2015, 4:35 PM

r255398