summaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r--test/Transforms/InstSimplify/compare.ll44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index 6ee6dfbdbc..85aea19e69 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