This is an archive of the discontinued LLVM Phabricator instance.

[Profile] Fix builtin_expect lowering bug
ClosedPublic

Authored by davidxl on Jun 1 2017, 12:05 AM.

Details

Summary

There is an obvious bug in the lowering code when non-boolean integer value is expected. The existing code wrongly assumes the NE comparison's constant operand is always zero and also skips EQ predicate. This either produces wrong profile annotation or misses annotation.

Other predicate kinds should also be supported (separately).

Diff Detail

Repository
rL LLVM

Event Timeline

davidxl created this revision.Jun 1 2017, 12:05 AM
danielcdh accepted this revision.Jun 1 2017, 9:09 AM
danielcdh added inline comments.
lib/Transforms/Scalar/LowerExpectIntrinsic.cpp
134 ↗(On Diff #100963)

Maybe inline the ExpectedValue->getZExtValue() so that there is no need to have ExpectedIntValue.

This revision is now accepted and ready to land.Jun 1 2017, 9:09 AM
This revision was automatically updated to reflect the committed changes.