diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-10 23:37:55 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-10 23:37:55 +0000 |
commit | db050e9d9673fda33b4acbf67b1137a6a91e74b7 (patch) | |
tree | 5e6c18363d9917d22eec2a3f54d9c9c24dd37aee /test | |
parent | ce128857e923728587cf38bac23d9f6ba231ca01 (diff) | |
download | external_llvm-db050e9d9673fda33b4acbf67b1137a6a91e74b7.zip external_llvm-db050e9d9673fda33b4acbf67b1137a6a91e74b7.tar.gz external_llvm-db050e9d9673fda33b4acbf67b1137a6a91e74b7.tar.bz2 |
Factor out the code for checking that all indices in a getelementptr are
within the notional bounds of the static type of the getelementptr (which
is not the same as "inbounds") from GlobalOpt into a utility routine,
and use it in ConstantFold.cpp to check whether there are any mis-behaved
indices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/getelementptr.ll | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index aa39752..444a0ee 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -459,3 +459,12 @@ define i8* @test36() nounwind { ; CHECK: ret i8* getelementptr ([11 x i8]* @array, i64 1676976733973595601, i64 4) } +; Instcombine shouldn't assume that gep(A,0,1) != gep(A,1,0). +@A37 = external constant [1 x i8] +define i1 @test37() nounwind { +; CHECK: @test37 +; CHECK: ret i1 icmp eq (i8* getelementptr ([1 x i8]* @A37, i64 0, i64 1), i8* getelementptr ([1 x i8]* @A37, i64 1, i64 0)) + %t = icmp eq i8* getelementptr ([1 x i8]* @A37, i64 0, i64 1), + getelementptr ([1 x i8]* @A37, i64 1, i64 0) + ret i1 %t +} |