summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll
diff options
context:
space:
mode:
authorDavid Stuttard <david.stuttard@amd.com>2019-03-20 09:29:55 +0000
committerDavid Stuttard <david.stuttard@amd.com>2019-03-20 09:29:55 +0000
commitfc2a74734574f752c3371369794904f10f2531a3 (patch)
treebb0d0b1de6a752419cc6dc9fd131cbab0db5aeb6 /llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll
parenta1aa7a4054e709c7120c2226898f0b4fb4348634 (diff)
downloadbcm5719-llvm-fc2a74734574f752c3371369794904f10f2531a3.tar.gz
bcm5719-llvm-fc2a74734574f752c3371369794904f10f2531a3.zip
[AMDGPU] Allow MIMG with no uses in adjustWritemask in isel
Summary: If an MIMG instruction has managed to get through to adjustWritemask in isel but has no uses (and doesn't enable TFC) then prevent an assertion by not attempting to adjust the writemask. The instruction will be removed anyway. Change-Id: I9a5dba6bafe1f35ac99c1b73df390936e2ac27a7 Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58964 llvm-svn: 356540
Diffstat (limited to 'llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll')
-rw-r--r--llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll b/llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll
new file mode 100644
index 00000000000..08e12ba2246
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/img-nouse-adjust.ll
@@ -0,0 +1,22 @@
+; RUN: llc -march=amdgcn -mcpu=gfx900 -start-before=amdgpu-isel -stop-after=amdgpu-isel -verify-machineinstrs < %s | FileCheck %s --check-prefix=GCN
+
+; We're really just checking for no crashes
+; The feature we're testing for in AdjustWriteMask leaves the image_load as an instruction just post amdgpu-isel
+; In reality, it's hard to get an image intrinsic into AdjustWriteMask with no uses as it will usually get removed
+; first, but it can happen, hence the fix associated with this test
+
+; GCN-LABEL: name: _amdgpu_cs_main
+; GCN-LABEL: bb.0
+; GCN: IMAGE_LOAD_V4_V2
+define amdgpu_cs void @_amdgpu_cs_main(i32 %dummy) local_unnamed_addr #0 {
+.entry:
+ %unused.result = tail call <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32 15, i32 undef, i32 undef, <8 x i32> undef, i32 0, i32 0) #3
+ call void asm sideeffect ";", "" () #0
+ ret void
+}
+
+; Function Attrs: nounwind readonly
+declare <4 x float> @llvm.amdgcn.image.load.2d.v4f32.i32(i32, i32, i32, <8 x i32>, i32, i32) #1
+
+attributes #0 = { nounwind }
+attributes #1 = { nounwind readonly }
OpenPOWER on IntegriCloud