[llvm] [LoopUnroll] Skip called function in constant-op reduction filter (PR #200868)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 21 14:12:10 PDT 2026
================
@@ -1727,10 +1727,16 @@ llvm::canParallelizeReductionWhenUnrolling(PHINode &Phi, Loop *L,
return std::nullopt;
// Don't unroll reductions with constant ops; those can be folded to a
- // single induction update.
- if (any_of(cast<Instruction>(Phi.getIncomingValueForBlock(L->getLoopLatch()))
- ->operands(),
- IsaPred<Constant>))
+ // single induction update. For calls (e.g. fmuladd or min/max
+ // intrinsics), the called function is itself a Constant operand and is
+ // not a reduction operand, so restrict the check to the argument list.
+ Instruction *LatchInst =
+ cast<Instruction>(Phi.getIncomingValueForBlock(L->getLoopLatch()));
----------------
fhahn wrote:
can re-use LatchInst below?
https://github.com/llvm/llvm-project/pull/200868
More information about the llvm-commits
mailing list