summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorEli Friedman <efriedma@codeaurora.org>2017-02-24 20:51:36 +0000
committerEli Friedman <efriedma@codeaurora.org>2017-02-24 20:51:36 +0000
commitc12a5a7595d30996804dc41e7150aec4e19e7c0a (patch)
treea419e1b2d7ae6f061416e38a8c2ddf59442a3d64 /llvm/test
parentcc0573b03fdc1ecfe88e255e71dcf947d831b457 (diff)
downloadbcm5719-llvm-c12a5a7595d30996804dc41e7150aec4e19e7c0a.tar.gz
bcm5719-llvm-c12a5a7595d30996804dc41e7150aec4e19e7c0a.zip
[CodeGenPrepare] Make -addr-sink-using-gep work with address spaces.
When we construct addressing modes, we use isNoopAddrSpaceCast to ignore addrspacecast instructions. Make sure we insert the correct addrspacecast when we reconstruct the addressing mode. Differential Revision: https://reviews.llvm.org/D30114 llvm-svn: 296167
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/CodeGenPrepare/X86/sink-addrspacecast.ll11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrspacecast.ll b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrspacecast.ll
index c9f49b5d4f8..eb2c985c70e 100644
--- a/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrspacecast.ll
+++ b/llvm/test/Transforms/CodeGenPrepare/X86/sink-addrspacecast.ll
@@ -1,11 +1,14 @@
-; RUN: opt -S -codegenprepare < %s | FileCheck %s
+; RUN: opt -S -codegenprepare < %s | FileCheck %s -check-prefix=CHECK -check-prefix=INT
+; RUN: opt -S -codegenprepare -addr-sink-using-gep=true < %s | FileCheck %s -check-prefix=CHECK -check-prefix=GEP
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"
; CHECK-LABEL: @load_cast_gep
-; CHECK: add i64 %sunkaddr, 40
+; INT: add i64 %sunkaddr, 40
+; GEP: [[CAST:%[0-9]+]] = addrspacecast i64* %base to i8 addrspace(1)*
+; GEP: getelementptr i8, i8 addrspace(1)* [[CAST]], i64 40
define void @load_cast_gep(i1 %cond, i64* %base) {
entry:
%addr = getelementptr inbounds i64, i64* %base, i64 5
@@ -21,7 +24,9 @@ fallthrough:
}
; CHECK-LABEL: @store_gep_cast
-; CHECK: add i64 %sunkaddr, 20
+; INT: add i64 %sunkaddr, 20
+; GEP: [[CAST:%[0-9]+]] = addrspacecast i64* %base to i8 addrspace(1)*
+; GEP: getelementptr i8, i8 addrspace(1)* [[CAST]], i64 20
define void @store_gep_cast(i1 %cond, i64* %base) {
entry:
%casted = addrspacecast i64* %base to i32 addrspace(1)*
OpenPOWER on IntegriCloud