diff options
| author | Eric Christopher <echristo@gmail.com> | 2019-04-17 04:52:47 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@gmail.com> | 2019-04-17 04:52:47 +0000 |
| commit | cee313d288a4faf0355d76fb6e0e927e211d08a5 (patch) | |
| tree | d386075318d761197779a96e5d8fc0dc7b06342b /llvm/test/Transforms/InferAddressSpaces/NVPTX | |
| parent | c3d6a929fdd92fd06d4304675ade8d7210ee711a (diff) | |
| download | bcm5719-llvm-cee313d288a4faf0355d76fb6e0e927e211d08a5.tar.gz bcm5719-llvm-cee313d288a4faf0355d76fb6e0e927e211d08a5.zip | |
Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.
Will be re-reverting again.
llvm-svn: 358552
Diffstat (limited to 'llvm/test/Transforms/InferAddressSpaces/NVPTX')
3 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InferAddressSpaces/NVPTX/bug31948.ll b/llvm/test/Transforms/InferAddressSpaces/NVPTX/bug31948.ll new file mode 100644 index 00000000000..b4e05b2e429 --- /dev/null +++ b/llvm/test/Transforms/InferAddressSpaces/NVPTX/bug31948.ll @@ -0,0 +1,24 @@ +; RUN: opt -S -mtriple=nvptx64-nvidia-cuda -infer-address-spaces %s | FileCheck %s + +target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64" + +%struct.bar = type { float, float* } + +@var1 = local_unnamed_addr addrspace(3) externally_initialized global %struct.bar undef, align 8 + +; CHECK-LABEL: @bug31948( +; CHECK: %tmp = load float*, float* addrspace(3)* getelementptr inbounds (%struct.bar, %struct.bar addrspace(3)* @var1, i64 0, i32 1), align 8 +; CHECK: %tmp1 = load float, float* %tmp, align 4 +; CHECK: store float %conv1, float* %tmp, align 4 +; CHECK: store i32 32, i32 addrspace(3)* bitcast (float* addrspace(3)* getelementptr inbounds (%struct.bar, %struct.bar addrspace(3)* @var1, i64 0, i32 1) to i32 addrspace(3)*), align 4 +define void @bug31948(float %a, float* nocapture readnone %x, float* nocapture readnone %y) local_unnamed_addr #0 { +entry: + %tmp = load float*, float** getelementptr (%struct.bar, %struct.bar* addrspacecast (%struct.bar addrspace(3)* @var1 to %struct.bar*), i64 0, i32 1), align 8 + %tmp1 = load float, float* %tmp, align 4 + %conv1 = fadd float %tmp1, 1.000000e+00 + store float %conv1, float* %tmp, align 4 + store i32 32, i32* bitcast (float** getelementptr (%struct.bar, %struct.bar* addrspacecast (%struct.bar addrspace(3)* @var1 to %struct.bar*), i64 0, i32 1) to i32*), align 4 + ret void +} + +attributes #0 = { norecurse nounwind } diff --git a/llvm/test/Transforms/InferAddressSpaces/NVPTX/clone_constexpr.ll b/llvm/test/Transforms/InferAddressSpaces/NVPTX/clone_constexpr.ll new file mode 100644 index 00000000000..1b324062057 --- /dev/null +++ b/llvm/test/Transforms/InferAddressSpaces/NVPTX/clone_constexpr.ll @@ -0,0 +1,36 @@ +; RUN: opt -S -mtriple=nvptx64-nvidia-cuda -infer-address-spaces %s | FileCheck %s + +%struct.S = type { [5 x i32] } + +$g1 = comdat any + +@g1 = linkonce_odr addrspace(3) global %struct.S zeroinitializer, comdat, align 4 + +; CHECK-LABEL: @foo( +; CHECK: %x0 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #2 +; CHECK: %idxprom.i = zext i32 %x0 to i64 +; CHECK: %arrayidx.i = getelementptr %struct.S, %struct.S* addrspacecast (%struct.S addrspace(3)* @g1 to %struct.S*), i64 0, i32 0, i64 %idxprom.i +; CHECK: tail call void @f1(i32* %arrayidx.i, i32 undef) #0 +; CHECK: %x1 = load i32, i32* getelementptr (%struct.S, %struct.S* addrspacecast (%struct.S addrspace(3)* @g1 to %struct.S*), i64 0, i32 0, i64 0), align 4 +; CHECK: %L.sroa.0.0.insert.ext.i = zext i32 %x1 to i64 +; CHECK: tail call void @f2(i64* null, i64 %L.sroa.0.0.insert.ext.i) #0 +; CHECK: ret void +define void @foo() local_unnamed_addr #0 { +entry: + %x0 = tail call i32 @llvm.nvvm.read.ptx.sreg.tid.x() #2 + %idxprom.i = zext i32 %x0 to i64 + %arrayidx.i = getelementptr %struct.S, %struct.S* addrspacecast (%struct.S addrspace(3)* @g1 to %struct.S*), i64 0, i32 0, i64 %idxprom.i + tail call void @f1(i32* %arrayidx.i, i32 undef) #0 + %x1 = load i32, i32* getelementptr (%struct.S, %struct.S* addrspacecast (%struct.S addrspace(3)* @g1 to %struct.S*), i64 0, i32 0, i64 0), align 4 + %L.sroa.0.0.insert.ext.i = zext i32 %x1 to i64 + tail call void @f2(i64* null, i64 %L.sroa.0.0.insert.ext.i) #0 + ret void +} + +declare void @f1(i32*, i32) local_unnamed_addr #0 +declare void @f2(i64*, i64) local_unnamed_addr #0 +declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1 + +attributes #0 = { convergent nounwind } +attributes #1 = { nounwind readnone } +attributes #2 = { nounwind } diff --git a/llvm/test/Transforms/InferAddressSpaces/NVPTX/lit.local.cfg b/llvm/test/Transforms/InferAddressSpaces/NVPTX/lit.local.cfg new file mode 100644 index 00000000000..2cb98eb371b --- /dev/null +++ b/llvm/test/Transforms/InferAddressSpaces/NVPTX/lit.local.cfg @@ -0,0 +1,2 @@ +if not 'NVPTX' in config.root.targets: + config.unsupported = True |

