Blame SOURCES/0001-Revert-Merging-r280589.patch

4ee08c
From 95b15b3d2f180b15267032e16c947c0f9b8a112d Mon Sep 17 00:00:00 2001
4ee08c
From: Dave Airlie <airlied@redhat.com>
4ee08c
Date: Wed, 1 Mar 2017 13:02:38 +1000
4ee08c
Subject: [PATCH] Revert "Merging r280589:"
4ee08c
4ee08c
This reverts commit 25e2616626caafb896517e18cd8aa724fba2b200.
4ee08c
---
4ee08c
 lib/Target/AMDGPU/SIInstructions.td   |  1 -
4ee08c
 lib/Target/AMDGPU/SIWholeQuadMode.cpp |  7 +++++
4ee08c
 test/CodeGen/AMDGPU/wqm.ll            | 49 +++--------------------------------
4ee08c
 3 files changed, 11 insertions(+), 46 deletions(-)
4ee08c
4ee08c
diff --git a/lib/Target/AMDGPU/SIInstructions.td b/lib/Target/AMDGPU/SIInstructions.td
4ee08c
index dde5f2f..18b7d5d 100644
4ee08c
--- a/lib/Target/AMDGPU/SIInstructions.td
4ee08c
+++ b/lib/Target/AMDGPU/SIInstructions.td
4ee08c
@@ -2029,7 +2029,6 @@ def SI_RETURN : PseudoInstSI <
4ee08c
   let hasSideEffects = 1;
4ee08c
   let SALU = 1;
4ee08c
   let hasNoSchedulingInfo = 1;
4ee08c
-  let DisableWQM = 1;
4ee08c
 }
4ee08c
 
4ee08c
 let Uses = [EXEC], Defs = [EXEC, VCC, M0],
4ee08c
diff --git a/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/lib/Target/AMDGPU/SIWholeQuadMode.cpp
4ee08c
index 1534d58..b200c15 100644
4ee08c
--- a/lib/Target/AMDGPU/SIWholeQuadMode.cpp
4ee08c
+++ b/lib/Target/AMDGPU/SIWholeQuadMode.cpp
4ee08c
@@ -219,6 +219,13 @@ char SIWholeQuadMode::scanInstructions(MachineFunction &MF,
4ee08c
       markInstruction(MI, Flags, Worklist);
4ee08c
       GlobalFlags |= Flags;
4ee08c
     }
4ee08c
+
4ee08c
+    if (WQMOutputs && MBB.succ_empty()) {
4ee08c
+      // This is a prolog shader. Make sure we go back to exact mode at the end.
4ee08c
+      Blocks[&MBB].OutNeeds = StateExact;
4ee08c
+      Worklist.push_back(&MBB);
4ee08c
+      GlobalFlags |= StateExact;
4ee08c
+    }
4ee08c
   }
4ee08c
 
4ee08c
   return GlobalFlags;
4ee08c
diff --git a/test/CodeGen/AMDGPU/wqm.ll b/test/CodeGen/AMDGPU/wqm.ll
4ee08c
index 41e4264..809a7ba 100644
4ee08c
--- a/test/CodeGen/AMDGPU/wqm.ll
4ee08c
+++ b/test/CodeGen/AMDGPU/wqm.ll
4ee08c
@@ -17,18 +17,17 @@ main_body:
4ee08c
 ;CHECK-LABEL: {{^}}test2:
4ee08c
 ;CHECK-NEXT: ; %main_body
4ee08c
 ;CHECK-NEXT: s_wqm_b64 exec, exec
4ee08c
+;CHECK: image_sample
4ee08c
 ;CHECK-NOT: exec
4ee08c
-define amdgpu_ps void @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) {
4ee08c
+;CHECK: _load_dword v0,
4ee08c
+define amdgpu_ps float @test2(<8 x i32> inreg %rsrc, <4 x i32> inreg %sampler, float addrspace(1)* inreg %ptr, <4 x i32> %c) {
4ee08c
 main_body:
4ee08c
   %c.1 = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %c, <8 x i32> %rsrc, <4 x i32> %sampler, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
4ee08c
   %c.2 = bitcast <4 x float> %c.1 to <4 x i32>
4ee08c
   %c.3 = extractelement <4 x i32> %c.2, i32 0
4ee08c
   %gep = getelementptr float, float addrspace(1)* %ptr, i32 %c.3
4ee08c
   %data = load float, float addrspace(1)* %gep
4ee08c
-
4ee08c
-  call void @llvm.SI.export(i32 15, i32 1, i32 1, i32 0, i32 1, float %data, float undef, float undef, float undef)
4ee08c
-
4ee08c
-  ret void
4ee08c
+  ret float %data
4ee08c
 }
4ee08c
 
4ee08c
 ; ... but disabled for stores (and, in this simple case, not re-enabled).
4ee08c
@@ -415,46 +414,6 @@ entry:
4ee08c
   ret void
4ee08c
 }
4ee08c
 
4ee08c
-; Must return to exact at the end of a non-void returning shader,
4ee08c
-; otherwise the EXEC mask exported by the epilog will be wrong. This is true
4ee08c
-; even if the shader has no kills, because a kill could have happened in a
4ee08c
-; previous shader fragment.
4ee08c
-;
4ee08c
-; CHECK-LABEL: {{^}}test_nonvoid_return:
4ee08c
-; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
4ee08c
-; CHECK: s_wqm_b64 exec, exec
4ee08c
-;
4ee08c
-; CHECK: s_and_b64 exec, exec, [[LIVE]]
4ee08c
-; CHECK-NOT: exec
4ee08c
-define amdgpu_ps <4 x float> @test_nonvoid_return() nounwind {
4ee08c
-  %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
4ee08c
-  %tex.i = bitcast <4 x float> %tex to <4 x i32>
4ee08c
-  %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
4ee08c
-  ret <4 x float> %dtex
4ee08c
-}
4ee08c
-
4ee08c
-; CHECK-LABEL: {{^}}test_nonvoid_return_unreachable:
4ee08c
-; CHECK: s_mov_b64 [[LIVE:s\[[0-9]+:[0-9]+\]]], exec
4ee08c
-; CHECK: s_wqm_b64 exec, exec
4ee08c
-;
4ee08c
-; CHECK: s_and_b64 exec, exec, [[LIVE]]
4ee08c
-; CHECK-NOT: exec
4ee08c
-define amdgpu_ps <4 x float> @test_nonvoid_return_unreachable(i32 inreg %c) nounwind {
4ee08c
-entry:
4ee08c
-  %tex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> undef, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
4ee08c
-  %tex.i = bitcast <4 x float> %tex to <4 x i32>
4ee08c
-  %dtex = call <4 x float> @llvm.SI.image.sample.v4i32(<4 x i32> %tex.i, <8 x i32> undef, <4 x i32> undef, i32 15, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0)
4ee08c
-
4ee08c
-  %cc = icmp sgt i32 %c, 0
4ee08c
-  br i1 %cc, label %if, label %else
4ee08c
-
4ee08c
-if:
4ee08c
-  store volatile <4 x float> %dtex, <4 x float>* undef
4ee08c
-  unreachable
4ee08c
-
4ee08c
-else:
4ee08c
-  ret <4 x float> %dtex
4ee08c
-}
4ee08c
 
4ee08c
 declare void @llvm.amdgcn.image.store.v4i32(<4 x float>, <4 x i32>, <8 x i32>, i32, i1, i1, i1, i1) #1
4ee08c
 declare void @llvm.amdgcn.buffer.store.f32(float, <4 x i32>, i32, i32, i1, i1) #1
4ee08c
-- 
4ee08c
2.9.3
4ee08c