[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


================
@@ -9240,6 +9262,20 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO,
 
       break; // Match!
     }
+    case Instruction::GetElementPtr: {
+      Value *LL;
+      Value *LR;
+      if (!match(L, m_PtrAdd(m_Value(LL), m_Value(LR))))
+        continue;
+
+      // Find a recurrence.
+      if (LL == P) {
+        // Found a match
+        L = LR;
+        break;
+      }
+      continue;
----------------
fhahn wrote:

Done thanks

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


More information about the llvm-commits mailing list