[PATCH] D91450: [BPI] Look through bitcasts in calcZeroHeuristic

Wei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 11:21:40 PST 2020


weiwang created this revision.
Herald added subscribers: llvm-commits, wenlei, hiraditya.
Herald added a project: LLVM.
weiwang requested review of this revision.

Constant hoisting may hide the constant value behind bitcast for And's
operand. Track down the constant.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D91450

Files:
  llvm/lib/Analysis/BranchProbabilityInfo.cpp


Index: llvm/lib/Analysis/BranchProbabilityInfo.cpp
===================================================================
--- llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -882,7 +882,7 @@
   // we don't have information about probabilities.
   if (Instruction *LHS = dyn_cast<Instruction>(CI->getOperand(0)))
     if (LHS->getOpcode() == Instruction::And)
-      if (ConstantInt *AndRHS = dyn_cast<ConstantInt>(LHS->getOperand(1)))
+      if (ConstantInt *AndRHS = GetConstantInt(LHS->getOperand(1)))
         if (AndRHS->getValue().isPowerOf2())
           return false;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D91450.305220.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201113/cfcad9e2/attachment.bin>


More information about the llvm-commits mailing list