[llvm] [InstCombine] Try optimizing with knownbits which determined from Cond (PR #91762)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 12 12:19:08 PDT 2024


================
@@ -1790,6 +1790,159 @@ static Instruction *foldSelectICmpEq(SelectInst &SI, ICmpInst *ICI,
   return nullptr;
 }
 
+// ICmpInst of SelectInst is not included in the calculation of KnownBits
+// so we are missing the opportunity to optimize the Value of the True or
+// False Condition via ICmpInst with KnownBits.
----------------
ParkHanbum wrote:

IMO, same way to use  computeKnownBitsFromCond, but computeKnownBitsFromOperator would compute known bits of SelectInst. I use Cond from SelectInst to estimate the KnownBits of the variables that make up Cond. The key is that if you can use it to estimate the known bits of Trueval, there is a difference in performing the optimization.



https://github.com/llvm/llvm-project/pull/91762


More information about the llvm-commits mailing list