diff options
author | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-10-19 18:59:03 +0000 |
---|---|---|
committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-10-19 18:59:03 +0000 |
commit | f2d5dc5dc6971c999c667bfd0ee6751deb9ef8de (patch) | |
tree | 1e0c958afd098f7853a087c68b9d987c6a33efd4 /lldb/packages/Python/lldbsuite/test/help/TestHelp.py | |
parent | 16970a847c00e9fac94b60b2179209edb24593ea (diff) | |
download | bcm5719-llvm-f2d5dc5dc6971c999c667bfd0ee6751deb9ef8de.tar.gz bcm5719-llvm-f2d5dc5dc6971c999c667bfd0ee6751deb9ef8de.zip |
[IndVarSimplify] Use control-dependent range information to prove non-negativity
This change is motivated by the case when IndVarSimplify doesn't widen a comparison of IV increment because it can't prove IV increment being non-negative. We end up with a redundant trunc of the widened increment on this example.
for.body:
%i = phi i32 [ %start, %for.body.lr.ph ], [ %i.inc, %for.inc ]
%within_limits = icmp ult i32 %i, 64
br i1 %within_limits, label %continue, label %for.end
continue:
%i.i64 = zext i32 %i to i64
%arrayidx = getelementptr inbounds i32, i32* %base, i64 %i.i64
%val = load i32, i32* %arrayidx, align 4
br label %for.inc
for.inc:
%i.inc = add nsw nuw i32 %i, 1
%cmp = icmp slt i32 %i.inc, %limit
br i1 %cmp, label %for.body, label %for.end
There is a range check inside of the loop which guarantees the IV to be non-negative. NSW on the increment guarantees that the increment is also non-negative. Teach IndVarSimplify to use the range check to prove non-negativity of loop increments.
Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D25738
llvm-svn: 284629
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/help/TestHelp.py')
0 files changed, 0 insertions, 0 deletions