aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/icmp.ll4
-rw-r--r--test/Transforms/InstSimplify/compare.ll44
2 files changed, 45 insertions, 3 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index dabb0f3..a9ae221 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -634,8 +634,6 @@ define i1 @test62(i8* %a) {
%arrayidx2 = getelementptr inbounds i8* %a, i64 10
%cmp = icmp slt i8* %arrayidx1, %arrayidx2
ret i1 %cmp
-; Don't turn a signed cmp of GEPs into an index compare.
; CHECK: @test62
-; CHECK: %cmp = icmp slt i8* %arrayidx1, %arrayidx2
-; CHECK-NEXT: ret i1 %cmp
+; CHECK-NEXT: ret i1 true
}
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index 6ee6dfb..85aea19 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -40,6 +40,50 @@ define i1 @gep2() {
; CHECK-NEXT: ret i1 true
}
+; PR11238
+%t = type { i32, i32 }
+@y = global %t zeroinitializer, align 8
+
+define i1 @gep3() {
+; CHECK: @gep3
+ %x = alloca %t, align 8
+ %a = getelementptr %t* %x, i64 0, i32 0
+ %b = getelementptr %t* %x, i64 0, i32 1
+ %equal = icmp eq i32* %a, %b
+ ret i1 %equal
+; CHECK-NEXT: ret i1 false
+}
+
+define i1 @gep4() {
+; CHECK: @gep4
+ %x = alloca %t, align 8
+ %a = getelementptr %t* @y, i64 0, i32 0
+ %b = getelementptr %t* @y, i64 0, i32 1
+ %equal = icmp eq i32* %a, %b
+ ret i1 %equal
+; CHECK-NEXT: ret i1 false
+}
+
+define i1 @gep5() {
+; CHECK: @gep5
+ %x = alloca %t, align 8
+ %a = getelementptr inbounds %t* %x, i64 0, i32 1
+ %b = getelementptr %t* @y, i64 0, i32 0
+ %equal = icmp eq i32* %a, %b
+ ret i1 %equal
+; CHECK-NEXT: ret i1 false
+}
+
+define i1 @gep6(%t* %x) {
+; Same as @gep3 but potentially null.
+; CHECK: @gep6
+ %a = getelementptr %t* %x, i64 0, i32 0
+ %b = getelementptr %t* %x, i64 0, i32 1
+ %equal = icmp eq i32* %a, %b
+ ret i1 %equal
+; CHECK-NEXT: ret i1 false
+}
+
define i1 @zext(i32 %x) {
; CHECK: @zext
%e1 = zext i32 %x to i64