[PATCH] D103255: [LV] Mark increment of main vector loop induction variable as NUW.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 27 07:56:20 PDT 2021
fhahn created this revision.
fhahn added reviewers: reames, Ayal, mkazantsev.
Herald added subscribers: javed.absar, hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.
This patch marks the induction increment of the main induction variable
of the vector loop as NUW when not folding the tail.
If the tail is not folded, we know that End - Start >= Step (either
statically or through the minimum iteration checks). We also know that both
Start % Step == 0 and End % Step == 0. We exit the vector loop if %IV +
%Step == %End. Hence we must exit the loop before %IV + %Step unsigned
overflows and we can mark the induction increment as NUW.
This should make SCEV return more precise bounds for the created vector
loops, used by later optimizations, like late unrolling.
At the moment quite a few tests still need to be updated, but before
doing so I'd like to get initial feedback to make sure I am not missing
anything.
Note that this could probably be further improved by using information
from the original IV.
Attempt of modeling of the assumption in Alive2:
https://alive2.llvm.org/ce/z/H_DL_g
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D103255
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/gather_scatter.ll
llvm/test/Transforms/LoopVectorize/pr39417-optsize-scevchecks.ll
llvm/test/Transforms/LoopVectorize/ptr-induction.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103255.348272.patch
Type: text/x-patch
Size: 9650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210527/baabff6c/attachment.bin>
More information about the llvm-commits
mailing list