[llvm] [VPlan] Use DIV nuw when optimizing latch exit user (PR #212292)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 02:50:00 PDT 2026
https://github.com/fhahn commented:
> > I'm confused about the alive2 link. `@src` returns 4 but `@tgt` returns 5. It's also trying to check a scalar loop and a vector loop. Shouldn't this be checking two vector loops to see if the equivalent VPlan optimization is correct?
>
> Ah yes, there was a one-token error which should be fixed now (https://alive2.llvm.org/ce/z/4nGpjg). The "vectorization" was reduced to testing just the code, but I've changed the labels now: hopefully it's clearer?
I think it is still not quite right and it looks like there may be an Alive2 bug somewhere. If I delete the sceond set of functions, the first set of functions fails to verify: https://alive2.llvm.org/ce/z/Rra7Wu
The target function adds `nuw` to the increment, but the phi starts at -1, so will warp in the first iteration.
Also I think the proof would need to be the other way around: src should have increment with `nuw` + instruction sequence to compute the end value from the exit count as DerivedIV will be expanded, without NUW.
`tgt` should have `nuw` added to the sequence computing the final value as the new code would generate.
Note that you will likely need at least a variable `%start` of the induction for generality.
https://github.com/llvm/llvm-project/pull/212292
More information about the llvm-commits
mailing list