[PATCH] D71855: AMDGPU/GlobalISel: Skip DAG hack passes on selected functions

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 24 06:14:01 PST 2019


arsenm created this revision.
arsenm added reviewers: nhaehnle, kerbowa, tstellar, dstuttard.
Herald added subscribers: Petar.Avramovic, hiraditya, t-tye, tpr, rovka, yaxunl, wdng, jvesely, kzhuravl.
Herald added a project: LLVM.

The way fallback to SelectionDAG works is somewhat surprising to
me. When the fallback path is enabled, the entire set of SelectionDAG
selector passes is added to the pass pipeline, and each one needs to
check if the function was selected. This results in the surprising
 behavior of running SIFixSGPRCopies for example, but only if
-global-isel-abort=2 is used.

     

SIAddIMGInitPass is also added in addInstSelector, but I'm not sure
why we have this pass or if it should be added somewhere else for
GlobalISel.


https://reviews.llvm.org/D71855

Files:
  llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
  llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp
  llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp


Index: llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp
+++ llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp
@@ -452,6 +452,11 @@
 /// all others, because phi lowering looks through copies and can therefore
 /// often make copy lowering unnecessary.
 bool SILowerI1Copies::runOnMachineFunction(MachineFunction &TheMF) {
+  // Only need to run this in SelectionDAG path.
+  if (TheMF.getProperties().hasProperty(
+        MachineFunctionProperties::Property::Selected))
+    return false;
+
   MF = &TheMF;
   MRI = &MF->getRegInfo();
   DT = &getAnalysis<MachineDominatorTree>();
Index: llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp
+++ llvm/lib/Target/AMDGPU/SIFixupVectorISel.cpp
@@ -217,6 +217,11 @@
 }
 
 bool SIFixupVectorISel::runOnMachineFunction(MachineFunction &MF) {
+  // Only need to run this in SelectionDAG path.
+  if (MF.getProperties().hasProperty(
+        MachineFunctionProperties::Property::Selected))
+    return false;
+
   if (skipFunction(MF.getFunction()))
     return false;
 
Index: llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
+++ llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
@@ -587,6 +587,11 @@
 }
 
 bool SIFixSGPRCopies::runOnMachineFunction(MachineFunction &MF) {
+  // Only need to run this in SelectionDAG path.
+  if (MF.getProperties().hasProperty(
+        MachineFunctionProperties::Property::Selected))
+    return false;
+
   const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
   MRI = &MF.getRegInfo();
   TRI = ST.getRegisterInfo();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71855.235218.patch
Type: text/x-patch
Size: 1814 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191224/464fb721/attachment.bin>


More information about the llvm-commits mailing list