[llvm] [LV] Create in-loop sub reductions (PR #147026)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 08:28:52 PDT 2025


================
@@ -1288,6 +1312,11 @@ RecurrenceDescriptor::getReductionOpChain(PHINode *Phi, Loop *L) const {
     if (isFMulAddIntrinsic(Cur))
       return true;
 
+    if (Cur->getOpcode() == Instruction::Sub && getOpcode() == Instruction::Add)
+      return true;
+    if (Cur->getOpcode() == Instruction::Add && getOpcode() == Instruction::Sub)
+      return true;
----------------
SamTebbs33 wrote:

That's true, done.

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


More information about the llvm-commits mailing list