[llvm] [LoopInterchange] Support inner-loop simple reductions via UndoSimpleReduction (PR #172970)
Ryotaro Kasuga via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 24 06:14:11 PST 2025
================
@@ -475,9 +481,33 @@ class LoopInterchangeLegality {
return HasNoWrapReductions;
}
+ // Record the simple reduction in the inner loop.
+ struct SimpleReduction {
+ // The reduction itself;
+ PHINode *Re;
+ // So far only supports constant initial value.
+ Value *Init;
+ Value *Next;
+ // The Lcssa PHI
+ PHINode *LcssaPhi;
+ // Only supports one user for now
+ // Store reduction result into memory object
+ StoreInst *LcssaStorer;
+ // The memory Location
+ Value *MemRef;
+ Type *ElemTy;
+
+ /// IV used for the loop exit condition.
+ PHINode *CounterIV;
+ };
+
+ const ArrayRef<SimpleReduction> getInnerSimpleReductions() const {
----------------
kasuga-fj wrote:
```suggestion
ArrayRef<SimpleReduction> getInnerSimpleReductions() const {
```
If I understand correctly, `ArrayRef` is immutable.
https://github.com/llvm/llvm-project/pull/172970
More information about the llvm-commits
mailing list