summaryrefslogtreecommitdiff
path: root/test/Transforms
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-09-30 21:06:18 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-09-30 21:06:18 +0000
commitf9dd19f49833e083f8d32ea015d6d5b57be5e4f4 (patch)
treed4c99bee9757bfd957f43603069a3c9a3105b50c /test/Transforms
parente5388399c795edd3687b08f33446a253d65247d6 (diff)
downloadllvm-f9dd19f49833e083f8d32ea015d6d5b57be5e4f4.tar.gz
llvm-f9dd19f49833e083f8d32ea015d6d5b57be5e4f4.tar.bz2
llvm-f9dd19f49833e083f8d32ea015d6d5b57be5e4f4.tar.xz
Constant fold ptrtoint + compare with address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191699 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/cast_ptr.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/cast_ptr.ll b/test/Transforms/InstCombine/cast_ptr.ll
index 62166adf01..d415810694 100644
--- a/test/Transforms/InstCombine/cast_ptr.ll
+++ b/test/Transforms/InstCombine/cast_ptr.ll
@@ -27,6 +27,26 @@ define i1 @test2(i8* %a, i8* %b) {
ret i1 %r
}
+; These casts should be folded away.
+; CHECK-LABEL: @test2_as2_same_int(
+; CHECK: icmp eq i8 addrspace(2)* %a, %b
+define i1 @test2_as2_same_int(i8 addrspace(2)* %a, i8 addrspace(2)* %b) {
+ %tmpa = ptrtoint i8 addrspace(2)* %a to i16
+ %tmpb = ptrtoint i8 addrspace(2)* %b to i16
+ %r = icmp eq i16 %tmpa, %tmpb
+ ret i1 %r
+}
+
+; These casts should be folded away.
+; CHECK-LABEL: @test2_as2_larger(
+; CHECK: icmp eq i8 addrspace(2)* %a, %b
+define i1 @test2_as2_larger(i8 addrspace(2)* %a, i8 addrspace(2)* %b) {
+ %tmpa = ptrtoint i8 addrspace(2)* %a to i32
+ %tmpb = ptrtoint i8 addrspace(2)* %b to i32
+ %r = icmp eq i32 %tmpa, %tmpb
+ ret i1 %r
+}
+
; These casts should also be folded away.
; CHECK-LABEL: @test3(
; CHECK: icmp eq i8* %a, @global