The ultimate reduction node may have multiple uses, but if the ultimate
reduction is min/max reduction and based on SelectInstruction, the
condition of this select instruction must have only single use.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/test/Transforms/SLPVectorizer/X86/horizontal-minmax.ll | ||
---|---|---|
908 | Here is an example of the bug, use undef instead of the result of icmp instruction (%10 in the test) |
The problem/test looks similar to the one in 0a8e7ca402e - can you explain how they differ (what allows these examples to avoid that fix)?
The reduced root is not select instruction anymore, it is an intrinsic call. And we cannot extract the condition
Can we remove the code that was added with D70148 then? (assert that the final cmp has only 1 use or 0 remaining uses?)
Hopefully, all of this becomes unnecessary after we switch to the min/max intrinsics.
I have another idea - try to keep cmpinstruction as an external user. Will try to implement it tomorrow.
Tried it and currently, it is impossible to implement, as we need to know the reduction result for n-1 reduction values. This can be improved later by the non-power-2 SLP patch
Here is an example of the bug, use undef instead of the result of icmp instruction (%10 in the test)