[PATCH] D33757: [Profile] Fix builtin_expect lowering bug

Dehao Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 09:09:39 PDT 2017


danielcdh accepted this revision.
danielcdh added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/Transforms/Scalar/LowerExpectIntrinsic.cpp:134
 
-  // If expect value is equal to 1 it means that we are more likely to take
-  // branch 0, in other case more likely is branch 1.
-  if (ExpectedValue->isOne())
+  if ((ExpectedIntValue == ValueComparedTo) == (Predicate == CmpInst::ICMP_EQ))
     Node = MDB.createBranchWeights(LikelyBranchWeight, UnlikelyBranchWeight);
----------------
Maybe inline the ExpectedValue->getZExtValue() so that there is no need to have ExpectedIntValue.


https://reviews.llvm.org/D33757





More information about the llvm-commits mailing list