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
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. |
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. |
Use an enum for these.