[llvm] [VPlan] Implement VPExtendedReduction, VPMulAccumulateReductionRecipe and corresponding vplan transformations. (PR #137746)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 13:44:53 PDT 2025


https://github.com/fhahn commented:

Glad to see getting rid of the cost changes worked out!

Some more suggestions, mostly around trying to have the API comments consistent.

I also did some testing and ran into an assert with the IR below

```
; bin/opt  -prefer-inloop-reductions=true -p loop-vectorize
 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx15.0.0"

define i32 @test(i32 %0) {
entry:
  br label %for.body143.i.i

for.body143.i.i:                                  ; preds = %for.end185.i.i, %entry
  %summa.1191.i.i = phi float [ 0.000000e+00, %entry ], [ %conv200.i.i, %for.end185.i.i ]
  br label %for.body157.i.i

for.body157.i.i:                                  ; preds = %for.body157.i.i, %for.body143.i.i
  %indvars.iv229.i.i1 = phi i64 [ 0, %for.body143.i.i ], [ %indvars.iv.next230.i.i, %for.body157.i.i ]
  %summer.1186.i.i = phi i32 [ 0, %for.body143.i.i ], [ %add174.i.i, %for.body157.i.i ]
  %conv167.i.i = fptosi float %summa.1191.i.i to i32
  %mul173.i.i = mul i32 %0, %conv167.i.i
  %add174.i.i = add i32 %mul173.i.i, %summer.1186.i.i
  %indvars.iv.next230.i.i = add i64 %indvars.iv229.i.i1, 1
  %exitcond232.not.i.i = icmp eq i64 %indvars.iv229.i.i1, 32
  br i1 %exitcond232.not.i.i, label %for.end185.i.i, label %for.body157.i.i

for.end185.i.i:                                   ; preds = %for.body157.i.i
  %conv200.i.i = sitofp i32 %add174.i.i to float
  br label %for.body143.i.i
}
```

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


More information about the llvm-commits mailing list