diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-08-19 22:17:40 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-08-19 22:17:40 +0000 |
commit | 8e3367ea36d7b25c79b9d3f14842e8f9c7c5801e (patch) | |
tree | 5e020450b57aec31b56dc02948be9059e546cbaa /test/Transforms | |
parent | c4ad982f0bbf4c3d8fc7babc832f0a75e615ba19 (diff) | |
download | external_llvm-8e3367ea36d7b25c79b9d3f14842e8f9c7c5801e.zip external_llvm-8e3367ea36d7b25c79b9d3f14842e8f9c7c5801e.tar.gz external_llvm-8e3367ea36d7b25c79b9d3f14842e8f9c7c5801e.tar.bz2 |
Teach InstCombine visitGetElementPtr about address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/cast.ll | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 52ea7b9..cac0ec1 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -1,6 +1,6 @@ ; Tests to make sure elimination of casts is working correctly ; RUN: opt < %s -instcombine -S | FileCheck %s -target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n8:16:32:64" +target datalayout = "E-p:64:64:64-p1:32:32:32-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128-n8:16:32:64" @inbuf = external global [32832 x i8] ; <[32832 x i8]*> [#uses=1] @@ -708,6 +708,19 @@ define %s @test68(%s *%p, i64 %i) { ; CHECK-NEXT: ret %s } +define %s @test68_as1(%s addrspace(1)* %p, i32 %i) { +; CHECK-LABEL: @test68_as1( + %o = mul i32 %i, 12 + %q = bitcast %s addrspace(1)* %p to i8 addrspace(1)* + %pp = getelementptr inbounds i8 addrspace(1)* %q, i32 %o +; CHECK-NEXT: getelementptr %s addrspace(1)* + %r = bitcast i8 addrspace(1)* %pp to %s addrspace(1)* + %l = load %s addrspace(1)* %r +; CHECK-NEXT: load %s addrspace(1)* + ret %s %l +; CHECK-NEXT: ret %s +} + define double @test69(double *%p, i64 %i) { ; CHECK-LABEL: @test69( %o = shl nsw i64 %i, 3 @@ -890,6 +903,20 @@ define double @test80([100 x double]* %p, i32 %i) { ; CHECK-NEXT: ret double } +define double @test80_as1([100 x double] addrspace(1)* %p, i16 %i) { +; CHECK-LABEL: @test80_as1( + %tmp = mul nsw i16 %i, 8 +; CHECK-NEXT: sext i16 %i to i32 + %q = bitcast [100 x double] addrspace(1)* %p to i8 addrspace(1)* + %pp = getelementptr i8 addrspace(1)* %q, i16 %tmp +; CHECK-NEXT: getelementptr [100 x double] addrspace(1)* + %r = bitcast i8 addrspace(1)* %pp to double addrspace(1)* + %l = load double addrspace(1)* %r +; CHECK-NEXT: load double addrspace(1)* + ret double %l +; CHECK-NEXT: ret double +} + define double @test81(double *%p, float %f) { %i = fptosi float %f to i64 %q = bitcast double* %p to i8* |