Test case for r150978.
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 20 Feb 2012 19:00:28 +0000 (19:00 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 20 Feb 2012 19:00:28 +0000 (19:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150979 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstCombine/icmp.ll

index 09152f0986787721b4a71f9344deeda9426e8308..8c4871942cb35bd0592798a5d8b4161938114b25 100644 (file)
@@ -615,3 +615,16 @@ define i1 @test60(i8* %foo, i64 %i, i64 %j) {
 ; CHECK-NEXT: icmp slt i64 %gep1.idx, %j
 ; CHECK-NEXT: ret i1
 }
+
+define i1 @test61(i8* %foo, i64 %i, i64 %j) {
+  %bit = bitcast i8* %foo to i32*
+  %gep1 = getelementptr i32* %bit, i64 %i
+  %gep2 = getelementptr  i8* %foo, i64 %j
+  %cast1 = bitcast i32* %gep1 to i8*
+  %cmp = icmp ult i8* %cast1, %gep2
+  ret i1 %cmp
+; Don't transform non-inbounds GEPs.
+; CHECK: @test61
+; CHECK: icmp ult i8* %cast1, %gep2
+; CHECK-NEXT: ret i1
+}