[llvm] [InstCombine] Create a class to lazily track computed known bits (PR #66611)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 10 02:41:13 PDT 2023


================
@@ -1566,7 +1566,9 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
     return replaceInstUsesWith(I, Constant::getNullValue(I.getType()));
 
   // A+B --> A|B iff A and B have no bits set in common.
-  if (haveNoCommonBitsSet(LHS, RHS, DL, &AC, &I, &DT))
+  CachedBitsConstValue LHSCache(LHS), RHSCache(RHS);
+  if (haveNoCommonBitsSet(LHSCache, RHSCache, DL, &AC, &I, &DT,
+                          /* ComputeKnownBitsBeforeHand */ true))
----------------
nikic wrote:

This is actually setting the UseInstrInfo flag. Though after a rebase on https://github.com/llvm/llvm-project/commit/80fa5a6377c44b3e78cddbe43abb79d209abc7e5 that should go away automatically...

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


More information about the llvm-commits mailing list