This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Use MachineBranchProbabilityInfo in EarlyIfPredicator to avoid the potential bug
ClosedPublic

Authored by ZhangKang on Dec 10 2019, 7:34 AM.

Details

Summary

In the function EarlyIfPredicator::shouldConvertIf(), we call TII->isProfitableToIfCvt() with BranchProbability::getUnknown(), it may cause the potential assertion error for those hook which use BranchProbability in isProfitableToIfCvt(), for example SystemZ.
SystemZ use Probability < BranchProbability(1, 8)) in the function SystemZInstrInfo::isProfitableToIfCvt(), if we call this function with BranchProbability::getUnknown(), it will cause assertion error.

In fact, it's hard to find a assertion test case, I have try it.

Now the pass EarlyIfPredicator haven't been enable, but this potential bug still need to be fixed.

Diff Detail

Event Timeline

ZhangKang created this revision.Dec 10 2019, 7:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2019, 7:34 AM
This revision is now accepted and ready to land.Dec 10 2019, 6:03 PM
This revision was automatically updated to reflect the committed changes.