[llvm] [ValueTracking] Support GEPs in matchSimpleRecurrence. (PR #123518)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 03:15:10 PST 2025


================
@@ -1571,12 +1572,21 @@ static void computeKnownBitsFromOperator(const Operator *I,
 
         // We need to take the minimum number of known bits
         KnownBits Known3(BitWidth);
+        if (BitWidth != getBitWidth(L->getType(), Q.DL)) {
+          assert(isa<GetElementPtrInst>(BO) &&
+                 "Bitwidth should only be different for GEPs.");
+          break;
+        }
         RecQ.CxtI = LInst;
         computeKnownBits(L, DemandedElts, Known3, Depth + 1, RecQ);
 
         Known.Zero.setLowBits(std::min(Known2.countMinTrailingZeros(),
                                        Known3.countMinTrailingZeros()));
 
+        // Don't apply logic below for GEPs.
+        if (isa<GetElementPtrInst>(BO))
+          break;
----------------
fhahn wrote:

Yep, removed, thanks

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


More information about the llvm-commits mailing list