[llvm] 525f9c0 - [AMDGPU][DPP] Corrected DPP combiner

Dmitry Preobrazhensky via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 04:58:39 PST 2019


Author: Dmitry Preobrazhensky
Date: 2019-11-20T15:56:45+03:00
New Revision: 525f9c0be538ba93e01b3a783d62b9f562e5a6b4

URL: https://github.com/llvm/llvm-project/commit/525f9c0be538ba93e01b3a783d62b9f562e5a6b4
DIFF: https://github.com/llvm/llvm-project/commit/525f9c0be538ba93e01b3a783d62b9f562e5a6b4.diff

LOG: [AMDGPU][DPP] Corrected DPP combiner

Added a check to make sure that the selected dpp opcode is supported by target.

Reviewers: vpykhtin, arsenm, rampitec

Differential Revision: https://reviews.llvm.org/D70402

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp b/llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp
index edf2b5f62b95..10e2c3a263f1 100644
--- a/llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNDPPCombine.cpp
@@ -104,6 +104,9 @@ class GCNDPPCombine : public MachineFunctionPass {
     AU.setPreservesCFG();
     MachineFunctionPass::getAnalysisUsage(AU);
   }
+
+private:
+  int getDPPOp(unsigned Op) const;
 };
 
 } // end anonymous namespace
@@ -118,13 +121,13 @@ FunctionPass *llvm::createGCNDPPCombinePass() {
   return new GCNDPPCombine();
 }
 
-static int getDPPOp(unsigned Op) {
+int GCNDPPCombine::getDPPOp(unsigned Op) const {
   auto DPP32 = AMDGPU::getDPPOp32(Op);
-  if (DPP32 != -1)
-    return DPP32;
-
-  auto E32 = AMDGPU::getVOPe32(Op);
-  return E32 != -1 ? AMDGPU::getDPPOp32(E32) : -1;
+  if (DPP32 == -1) {
+    auto E32 = AMDGPU::getVOPe32(Op);
+    DPP32 = (E32 == -1)? -1 : AMDGPU::getDPPOp32(E32);
+  }
+  return (DPP32 == -1 || TII->pseudoToMCOpcode(DPP32) == -1) ? -1 : DPP32;
 }
 
 // tracks the register operand definition and returns:


        


More information about the llvm-commits mailing list