| Issue |
172976
|
| Summary |
[LV][EVL] Simplifying the initial value of first-order recurrence phis.
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Mel-Chen
|
Regardless of the tail-folding strategy, for VF > 1, the initial value of a first-order recurrence phi is currently `[poison, ..., poison, start value]`.
With first-order recurrence under EVL tail folding, a scalar phi (`%prev.evl`) is used to record the EVL from the previous iteration, and `vp.splice(%vec1, %vec2, -1, true, %prev.evl, %evl)` is used instead of `vector.splice`. By setting `%prev.evl` to 1 instead of VF, the initial value of the first-order recurrence phi can be changed to `[start value, poison, ..., poison]`. This reduces the number of instructions needed to generate the initial value.
```
Preheader:
%init = insertelement poison, start_value, 0
Loop:
%for.phi = %init, %backedge_value
%prev.evl = 1, %evl
...
%for.splice = vp.splice(%for.phi, %op, %mask, %prev.evl, %evl)
...
```
Current first-order recurrence: https://godbolt.org/z/9Pcn8Gsab
The new initial way that this issue described: https://godbolt.org/z/69sfr8brj
However, this differs from the approach preferred by most reviewers. https://github.com/llvm/llvm-project/pull/172009
The current preference is to expand `VPFirstOrderRecurrencePHIRecipe` in `VPlanTransform::convertToConcreteRecipes` into `VPInstruction::InsertElement` and `VPWidenPHIRecipe`. For EVL tail folding, though, we would need to generate something like `VPInstruction::InsertFirstLane` for the initial value during EVL lowering.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs