diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-02-10 07:11:16 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-02-10 07:11:16 +0000 |
| commit | d86ded17add6e221d1bc48f1bfd342564ea0a3b9 (patch) | |
| tree | e8c4629f8a1d9f6516dccbb338ecf441d10e3118 /llvm/test/Transforms/InstCombine/sub.ll | |
| parent | e9b4ad7391d88e7a81cb863ae5da78b2635080ea (diff) | |
| download | bcm5719-llvm-d86ded17add6e221d1bc48f1bfd342564ea0a3b9.tar.gz bcm5719-llvm-d86ded17add6e221d1bc48f1bfd342564ea0a3b9.zip | |
implement the first part of PR8882: when lowering an inbounds
gep to explicit addressing, we know that none of the intermediate
computation overflows.
This could use review: it seems that the shifts certainly wouldn't
overflow, but could the intermediate adds overflow if there is a
negative index?
Previously the testcase would instcombine to:
define i1 @test(i64 %i) {
%p1.idx.mask = and i64 %i, 4611686018427387903
%cmp = icmp eq i64 %p1.idx.mask, 1000
ret i1 %cmp
}
now we get:
define i1 @test(i64 %i) {
%cmp = icmp eq i64 %i, 1000
ret i1 %cmp
}
llvm-svn: 125271
Diffstat (limited to 'llvm/test/Transforms/InstCombine/sub.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/sub.ll | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstCombine/sub.ll b/llvm/test/Transforms/InstCombine/sub.ll index 29d96a4d5c3..778a1b9db5d 100644 --- a/llvm/test/Transforms/InstCombine/sub.ll +++ b/llvm/test/Transforms/InstCombine/sub.ll @@ -256,7 +256,7 @@ define i64 @test24b(i8* %P, i64 %A){ %G = sub i64 %C, ptrtoint ([42 x i16]* @Arr to i64) ret i64 %G ; CHECK: @test24b -; CHECK-NEXT: shl i64 %A, 1 +; CHECK-NEXT: shl nuw i64 %A, 1 ; CHECK-NEXT: ret i64 } @@ -267,7 +267,7 @@ define i64 @test25(i8* %P, i64 %A){ %G = sub i64 %C, ptrtoint (i16* getelementptr ([42 x i16]* @Arr, i64 1, i64 0) to i64) ret i64 %G ; CHECK: @test25 -; CHECK-NEXT: shl i64 %A, 1 +; CHECK-NEXT: shl nuw i64 %A, 1 ; CHECK-NEXT: add i64 {{.*}}, -84 ; CHECK-NEXT: ret i64 } |

