aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify/compare.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-02-25 20:19:07 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-02-25 20:19:07 +0000
commit28e215ba63164f201292f8c77bf038b4282aa052 (patch)
tree39f1ffa20bb69ab0f1d72207445d08f400eff7cf /test/Transforms/InstSimplify/compare.ll
parent6bfb9d6a13261948c07599922246ac80e2ba66d0 (diff)
An argument and a local identified object (eg. a noalias call) could turn out
equal if both are null. In the test, scope type %t and global @y by adding a 'gep' prefix to them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify/compare.ll')
-rw-r--r--test/Transforms/InstSimplify/compare.ll38
1 files changed, 24 insertions, 14 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll
index 85aea19e69..ea43f5fa45 100644
--- a/test/Transforms/InstSimplify/compare.ll
+++ b/test/Transforms/InstSimplify/compare.ll
@@ -41,14 +41,15 @@ define i1 @gep2() {
}
; PR11238
-%t = type { i32, i32 }
-@y = global %t zeroinitializer, align 8
+%gept = type { i32, i32 }
+@gepy = global %gept zeroinitializer, align 8
+@gepz = extern_weak global %gept
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
+ %x = alloca %gept, align 8
+ %a = getelementptr %gept* %x, i64 0, i32 0
+ %b = getelementptr %gept* %x, i64 0, i32 1
%equal = icmp eq i32* %a, %b
ret i1 %equal
; CHECK-NEXT: ret i1 false
@@ -56,9 +57,9 @@ define i1 @gep3() {
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
+ %x = alloca %gept, align 8
+ %a = getelementptr %gept* @gepy, i64 0, i32 0
+ %b = getelementptr %gept* @gepy, i64 0, i32 1
%equal = icmp eq i32* %a, %b
ret i1 %equal
; CHECK-NEXT: ret i1 false
@@ -66,24 +67,33 @@ define i1 @gep4() {
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
+ %x = alloca %gept, align 8
+ %a = getelementptr inbounds %gept* %x, i64 0, i32 1
+ %b = getelementptr %gept* @gepy, i64 0, i32 0
%equal = icmp eq i32* %a, %b
ret i1 %equal
; CHECK-NEXT: ret i1 false
}
-define i1 @gep6(%t* %x) {
+define i1 @gep6(%gept* %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
+ %a = getelementptr %gept* %x, i64 0, i32 0
+ %b = getelementptr %gept* %x, i64 0, i32 1
%equal = icmp eq i32* %a, %b
ret i1 %equal
; CHECK-NEXT: ret i1 false
}
+define i1 @gep7(%gept* %x) {
+; CHECK: @gep7
+ %a = getelementptr %gept* %x, i64 0, i32 0
+ %b = getelementptr %gept* @gepz, i64 0, i32 0
+ %equal = icmp eq i32* %a, %b
+ ret i1 %equal
+; CHECK: ret i1 %equal
+}
+
define i1 @zext(i32 %x) {
; CHECK: @zext
%e1 = zext i32 %x to i64