aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-01-15 20:45:46 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-01-15 20:45:46 +0000
commit7059e2959d61c5b97916e1a02c610d68aed9a1fe (patch)
tree9ca83d0de152630e1f6d272c177e0eea1eaa9124 /clang/lib/CodeGen/CodeGenModule.cpp
parent5ef58eb86d9d2ff67157d6a1427dac3678a5e085 (diff)
downloadllvm-7059e2959d61c5b97916e1a02c610d68aed9a1fe.zip
llvm-7059e2959d61c5b97916e1a02c610d68aed9a1fe.tar.gz
llvm-7059e2959d61c5b97916e1a02c610d68aed9a1fe.tar.bz2
Add a new pass "inductive range check elimination"
IRCE eliminates range checks of the form 0 <= A * I + B < Length by splitting a loop's iteration space into three segments in a way that the check is completely redundant in the middle segment. As an example, IRCE will convert len = < known positive > for (i = 0; i < n; i++) { if (0 <= i && i < len) { do_something(); } else { throw_out_of_bounds(); } } to len = < known positive > limit = smin(n, len) // no first segment for (i = 0; i < limit; i++) { if (0 <= i && i < len) { // this check is fully redundant do_something(); } else { throw_out_of_bounds(); } } for (i = limit; i < n; i++) { if (0 <= i && i < len) { do_something(); } else { throw_out_of_bounds(); } } IRCE can deal with multiple range checks in the same loop (it takes the intersection of the ranges that will make each of them redundant individually). Currently IRCE does not do any profitability analysis. That is a TODO. Please note that the status of this pass is *experimental*, and it is not part of any default pass pipeline. Having said that, I will love to get feedback and general input from people interested in trying this out. Differential Revision: http://reviews.llvm.org/D6693 llvm-svn: 226201
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions