[PATCH] D29034: [Guards] Introduce loop-predication pass
Artur Pilipenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 08:08:02 PST 2017
apilipenko created this revision.
Herald added subscribers: mgorny, mzolotukhin.
This patch introduces guard based loop predication optimization. The new LoopPredication pass tries to convert loop variant range checks to loop invariant by widening checks across loop iterations. For example, it will convert
for (i = 0; i < n; i++) {
guard(i < len);
...
}
to
for (i = 0; i < n; i++) {
guard(n - 1 < len);
...
}
After this transformation the condition of the guard is loop invariant, so loop-unswitch can later unswitch the loop by this condition which basically predicates the loop by the widened condition:
if (n - 1 < len)
for (i = 0; i < n; i++) {
...
}
else
deoptimize
https://reviews.llvm.org/D29034
Files:
include/llvm/InitializePasses.h
include/llvm/LinkAllPasses.h
include/llvm/Transforms/Scalar.h
lib/Transforms/Scalar/CMakeLists.txt
lib/Transforms/Scalar/LoopPredication.cpp
lib/Transforms/Scalar/Scalar.cpp
test/Transforms/LoopPredication/basic.ll
test/Transforms/LoopPredication/nested.ll
test/Transforms/LoopPredication/visited.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29034.85395.patch
Type: text/x-patch
Size: 43753 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170123/5f3446a0/attachment.bin>
More information about the llvm-commits
mailing list