Recommit #2: "[LV] Induction Variable does not remain scalar under tail-folding."
This was reverted because of a miscompilation. At closer inspection, the problem was actually visible in a changed llvm regression test too. This one-line follow up fix/recommit will splat the IV, which is what we are trying to avoid if unnecessary in general, if tail-folding is requested even if all users are scalar instructions after vectorisation. Because with tail-folding, the splat IV will be used by the predicate of the masked loads/stores instructions. The previous version omitted this, which caused the miscompilation. The original commit message was: If tail-folding of the scalar remainder loop is applied, the primary induction variable is splat to a vector and used by the masked load/store vector instructions, thus the IV does not remain scalar. Because we now mark that the IV does not remain scalar for these cases, we don't emit the vector IV if it is not used. Thus, the vectoriser produces less dead code. Thanks to Ayal Zaks for the direction how to fix this.
Showing
- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp 10 additions, 4 deletionsllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
- llvm/test/Transforms/LoopVectorize/AArch64/extractvalue-no-scalarization-required.ll 0 additions, 6 deletions...ctorize/AArch64/extractvalue-no-scalarization-required.ll
- llvm/test/Transforms/LoopVectorize/AArch64/pr36032.ll 0 additions, 6 deletionsllvm/test/Transforms/LoopVectorize/AArch64/pr36032.ll
- llvm/test/Transforms/LoopVectorize/ARM/sphinx.ll 0 additions, 3 deletionsllvm/test/Transforms/LoopVectorize/ARM/sphinx.ll
- llvm/test/Transforms/LoopVectorize/Hexagon/invalidate-cm-after-invalidating-interleavegroups.ll 1 addition, 2 deletions...agon/invalidate-cm-after-invalidating-interleavegroups.ll
- llvm/test/Transforms/LoopVectorize/PowerPC/vectorize-bswap.ll 0 additions, 3 deletions.../test/Transforms/LoopVectorize/PowerPC/vectorize-bswap.ll
- llvm/test/Transforms/LoopVectorize/SystemZ/predicated-first-order-recurrence.ll 3 additions, 4 deletions...oopVectorize/SystemZ/predicated-first-order-recurrence.ll
- llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll 19 additions, 0 deletionsllvm/test/Transforms/LoopVectorize/X86/constant-fold.ll
- llvm/test/Transforms/LoopVectorize/X86/imprecise-through-phis.ll 0 additions, 3 deletions...st/Transforms/LoopVectorize/X86/imprecise-through-phis.ll
- llvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll 316 additions, 370 deletionsllvm/test/Transforms/LoopVectorize/X86/load-deref-pred.ll
- llvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll 246 additions, 351 deletionsllvm/test/Transforms/LoopVectorize/X86/masked_load_store.ll
- llvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll 240 additions, 246 deletionsllvm/test/Transforms/LoopVectorize/X86/metadata-enable.ll
- llvm/test/Transforms/LoopVectorize/X86/optsize.ll 140 additions, 16 deletionsllvm/test/Transforms/LoopVectorize/X86/optsize.ll
- llvm/test/Transforms/LoopVectorize/X86/pr35432.ll 8 additions, 12 deletionsllvm/test/Transforms/LoopVectorize/X86/pr35432.ll
- llvm/test/Transforms/LoopVectorize/X86/pr36524.ll 0 additions, 3 deletionsllvm/test/Transforms/LoopVectorize/X86/pr36524.ll
- llvm/test/Transforms/LoopVectorize/X86/small-size.ll 323 additions, 53 deletionsllvm/test/Transforms/LoopVectorize/X86/small-size.ll
- llvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll 0 additions, 3 deletionsllvm/test/Transforms/LoopVectorize/X86/strided_load_cost.ll
- llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll 20 additions, 10 deletions...t/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll
- llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-accesses-masked-group.ll 1730 additions, 191 deletions...oopVectorize/X86/x86-interleaved-accesses-masked-group.ll
- llvm/test/Transforms/LoopVectorize/fcmp-vectorize.ll 0 additions, 2 deletionsllvm/test/Transforms/LoopVectorize/fcmp-vectorize.ll
Loading
Please register or sign in to comment