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

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 13 01:29:57 PDT 2025


https://github.com/rj-jesus created https://github.com/llvm/llvm-project/pull/144031

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

>From ffa3807e549a2f2c3286d2c8ab5f3358408c8ca1 Mon Sep 17 00:00:00 2001
From: Ricardo Jesus <rjj at nvidia.com>
Date: Thu, 12 Jun 2025 10:08:55 -0700
Subject: [PATCH] [ValueTracking] Handle FADD and XOR in matchSimpleRecurrence.

Note: I'm not sure how this can be tested, but #143878 is affected by
this change.
---
 llvm/lib/Analysis/ValueTracking.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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);



More information about the llvm-commits mailing list