[llvm] [VPlan] Optimize FindLast of (binop %IV, live-in) by sinking. (PR #183911)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 11:13:23 PDT 2026


alinas wrote:

Diff after optimizations I can share so far, in case it helps infer the issue without a full repro yet:

Before (correct):
```
for.cond.cleanup324:                              ; preds = %vector.body           
  %90 = icmp ult <4 x i32> %vec.ind, splat (i32 7)                                 
  %91 = select <4 x i1> %90, <4 x i32> %88, <4 x i32> %vec.phi
  %92 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %91)
  %93 = mul i32 %92, 1440                                       
```

After (incorrect):
```
for.cond.cleanup324:                              ; preds = %vector.body
  %90 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %88)
  %91 = mul i32 %90, 1440
```



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


More information about the llvm-commits mailing list