aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-21 19:09:28 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2013-08-21 19:09:28 +0000
commit795cfe3cfd48f7fc3794da8ce4fe0811bf1e298d (patch)
tree957fd18b768920acc6c3945cf11c99d0905414c4 /test/Transforms/InstCombine
parent606deaf147a8593518a9719af8715d0d328a22cf (diff)
downloadexternal_llvm-795cfe3cfd48f7fc3794da8ce4fe0811bf1e298d.zip
external_llvm-795cfe3cfd48f7fc3794da8ce4fe0811bf1e298d.tar.gz
external_llvm-795cfe3cfd48f7fc3794da8ce4fe0811bf1e298d.tar.bz2
Add test for bitcast array ptrs with address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188919 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/getelementptr.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll
index cd7a925..a5d5ddc 100644
--- a/test/Transforms/InstCombine/getelementptr.ll
+++ b/test/Transforms/InstCombine/getelementptr.ll
@@ -662,4 +662,26 @@ define i8 @test_gep_bitcast_array_different_size_element([100 x double]* %arr, i
ret i8 %x
}
+define i64 @test_gep_bitcast_array_same_size_element_as1([100 x double] addrspace(1)* %arr, i16 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_same_size_element_as1(
+; CHECK: getelementptr [100 x double] addrspace(1)* %arr, i16 0, i16 %V
+; CHECK: bitcast
+ %cast = bitcast [100 x double] addrspace(1)* %arr to i64 addrspace(1)*
+ %V = mul i16 %N, 8
+ %t = getelementptr i64 addrspace(1)* %cast, i16 %V
+ %x = load i64 addrspace(1)* %t
+ ret i64 %x
+}
+
+define i8 @test_gep_bitcast_array_different_size_element_as1([100 x double] addrspace(1)* %arr, i16 %N) {
+; CHECK-LABEL: @test_gep_bitcast_array_different_size_element_as1(
+; CHECK: getelementptr [100 x double] addrspace(1)* %arr, i16 0, i16 %N
+; CHECK: bitcast
+ %cast = bitcast [100 x double] addrspace(1)* %arr to i8 addrspace(1)*
+ %V = mul i16 %N, 8
+ %t = getelementptr i8 addrspace(1)* %cast, i16 %V
+ %x = load i8 addrspace(1)* %t
+ ret i8 %x
+}
+
; CHECK: attributes [[NUW]] = { nounwind }