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 | 7190d480758fd7fe2f9d87bee25b97468fcbf39f (patch) | |
tree | dbad9ff5ee1c824d547c5909303d3221c5cbedd6 /llvm/test/Transforms/InstCombine/getelementptr.ll | |
parent | 8ef65fbd49bdcd41583424ef40b4ddbd04d7908a (diff) | |
download | bcm5719-llvm-7190d480758fd7fe2f9d87bee25b97468fcbf39f.tar.gz bcm5719-llvm-7190d480758fd7fe2f9d87bee25b97468fcbf39f.zip |
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.
llvm-svn: 81478
Diffstat (limited to 'llvm/test/Transforms/InstCombine/getelementptr.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/getelementptr.ll | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/getelementptr.ll b/llvm/test/Transforms/InstCombine/getelementptr.ll index aa39752c460..444a0ee9389 100644 --- a/llvm/test/Transforms/InstCombine/getelementptr.ll +++ b/llvm/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 +} |