[llvm] [ValueTracking] Handle FADD and XOR in matchSimpleRecurrence. (PR #144031)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 13 01:30:26 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ricardo Jesus (rj-jesus)

<details>
<summary>Changes</summary>

Note: I'm not sure how to test this, but #<!-- -->143878 is affected by this change.

---
Full diff: https://github.com/llvm/llvm-project/pull/144031.diff


1 Files Affected:

- (modified) llvm/lib/Analysis/ValueTracking.cpp (+3-1) 


``````````diff
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 0a460786d00ea..a9edb02440b5e 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -9072,7 +9072,7 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO,
     switch (Opcode) {
     default:
       continue;
-    // TODO: Expand list -- xor, gep, uadd.sat etc.
+    // TODO: Expand list -- gep, uadd.sat etc.
     case Instruction::LShr:
     case Instruction::AShr:
     case Instruction::Shl:
@@ -9082,7 +9082,9 @@ bool llvm::matchSimpleRecurrence(const PHINode *P, BinaryOperator *&BO,
     case Instruction::URem:
     case Instruction::And:
     case Instruction::Or:
+    case Instruction::Xor:
     case Instruction::Mul:
+    case Instruction::FAdd:
     case Instruction::FMul: {
       Value *LL = LU->getOperand(0);
       Value *LR = LU->getOperand(1);

``````````

</details>


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


More information about the llvm-commits mailing list