[PATCH] D29070: AMDGPU: Run AMDGPUCodeGenPrepare after inlining

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 23 19:34:28 PST 2017


arsenm created this revision.
Herald added a reviewer: tstellarAMD.
Herald added subscribers: tony-tye, yaxunl, nhaehnle, wdng, kzhuravl.

With leaf functions, this makes nonsensical decisions
based on the uniformity of the arguments.


https://reviews.llvm.org/D29070

Files:
  lib/Target/AMDGPU/AMDGPUTargetMachine.cpp


Index: lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -356,7 +356,6 @@
   ScheduleDAGInstrs *
   createMachineScheduler(MachineSchedContext *C) const override;
 
-  void addIRPasses() override;
   bool addPreISel() override;
   void addMachineSSAOptimization() override;
   bool addInstSelector() override;
@@ -421,10 +420,18 @@
   // without ever running any passes on the second.
   addPass(createBarrierNoopPass());
 
+  const AMDGPUTargetMachine &TM = getAMDGPUTargetMachine();
+
+  if (TM.getTargetTriple().getArch() == Triple::amdgcn) {
+    // TODO: May want to move later or split into an early and late one.
+
+    addPass(createAMDGPUCodeGenPreparePass(
+              static_cast<const GCNTargetMachine *>(&TM)));
+  }
+
   // Handle uses of OpenCL image2d_t, image3d_t and sampler_t arguments.
   addPass(createAMDGPUOpenCLImageTypeLoweringPass());
 
-  const AMDGPUTargetMachine &TM = getAMDGPUTargetMachine();
   if (TM.getOptLevel() > CodeGenOpt::None) {
     addPass(createAMDGPUPromoteAlloca(&TM));
 
@@ -551,13 +558,6 @@
   addPass(&SILoadStoreOptimizerID);
 }
 
-void GCNPassConfig::addIRPasses() {
-  // TODO: May want to move later or split into an early and late one.
-  addPass(createAMDGPUCodeGenPreparePass(&getGCNTargetMachine()));
-
-  AMDGPUPassConfig::addIRPasses();
-}
-
 bool GCNPassConfig::addInstSelector() {
   AMDGPUPassConfig::addInstSelector();
   addPass(createSILowerI1CopiesPass());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29070.85520.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170124/cae1a2f1/attachment.bin>


More information about the llvm-commits mailing list