When number of needed runtime checks exceeds threshold, but user
requested vectorization, loop vectorizer simply doesn't generate them
which results to invalid vector code.
The patch simply forced generation of rt-checks when vectorization is
forced
Details
Diff Detail
Event Timeline
Thanks for the patch! Add some suggestion on how to simplify the tests a bit. Also, could you pre-commit the simplified tests independent of the patch and then update the revision here to just show the difference caused by the patch?
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
1919 | nit: period at end of sentence. | |
llvm/test/Transforms/LoopVectorize/memcheck_threashold_vec_forced.ll | ||
6 | Given that the test checks the full IR, it would probably be better to remove the check of debug output and run it unconditionally (remove REQUIRES: asserts). | |
63 | the check shouldn't be needed. | |
67 | can just pass %n as i64 and get rid of the zext. | |
71 | can directly return here and maybe move the exit block to the end of the function. | |
77 | can drop indvars. prefix to make value names more compact and readable. |
Addressed comments
llvm/test/Transforms/LoopVectorize/memcheck_threashold_vec_forced.ll | ||
---|---|---|
6 | Mostly I added it to check that vec_not_forced is not vectorized due to the number of checks exceeded threshold. Agree that for the vec_forced it's not needed though, just tried to keep checks similar |
LGTM thanks! Please reference the bug in the commit message.
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | ||
---|---|---|
1919 | nit: perhaps: unless the user... |
nit: period at end of sentence.