[PATCH] D29189: [AMDGPU] Turn AMDGPUUnifyMetadata back into module pass

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 08:49:24 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL293300: [AMDGPU] Turn AMDGPUUnifyMetadata back into module pass (authored by rampitec).

Changed prior to commit:
  https://reviews.llvm.org/D29189?vs=85936&id=86059#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29189

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPU.h
  llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
  llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
  llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll


Index: llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/unify-metadata.ll
@@ -14,10 +14,6 @@
 ; ALL-DAG: ![[USED_EXT_1]] = !{!"cl_khr_fp16"}
 ; ALL-DAG: ![[USED_EXT_2]] = !{!"cl_doubles"}
 
-define void @test() {
-   ret void
-}
-
 !opencl.ocl.version = !{!1, !0, !0, !0}
 !llvm.ident = !{!2, !2, !2, !2, !6}
 !opencl.used.extensions = !{!3, !3, !4, !5}
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUUnifyMetadata.cpp
@@ -38,22 +38,14 @@
   } // end namespace kOCLMD
 
   /// \brief Unify multiple OpenCL metadata due to linking.
-  class AMDGPUUnifyMetadata : public FunctionPass {
+  class AMDGPUUnifyMetadata : public ModulePass {
   public:
     static char ID;
-
-    explicit AMDGPUUnifyMetadata() : FunctionPass(ID) {}
+    explicit AMDGPUUnifyMetadata() : ModulePass(ID) {};
 
   private:
-    // This should really be a module pass but we have to run it as early
-    // as possible, so given function passes are executed first and
-    // TargetMachine::addEarlyAsPossiblePasses() expects only function passes
-    // it has to be a function pass.
     virtual bool runOnModule(Module &M);
 
-    // \todo: Convert to a module pass.
-    bool runOnFunction(Function &F) override;
-
     /// \brief Unify version metadata.
     /// \return true if changes are made.
     /// Assume the named metadata has operands each of which is a pair of
@@ -126,7 +118,7 @@
                 "Unify multiple OpenCL metadata due to linking",
                 false, false)
 
-FunctionPass* llvm::createAMDGPUUnifyMetadataPass() {
+ModulePass* llvm::createAMDGPUUnifyMetadataPass() {
   return new AMDGPUUnifyMetadata();
 }
 
@@ -152,7 +144,3 @@
 
   return Changed;
 }
-
-bool AMDGPUUnifyMetadata::runOnFunction(Function &F) {
-  return runOnModule(*F.getParent());
-}
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -208,7 +208,7 @@
 
 void AMDGPUTargetMachine::adjustPassManager(PassManagerBuilder &Builder) {
   Builder.addExtension(
-    PassManagerBuilder::EP_EarlyAsPossible,
+    PassManagerBuilder::EP_ModuleOptimizerEarly,
     [&](const PassManagerBuilder &, legacy::PassManagerBase &PM) {
       PM.add(createAMDGPUUnifyMetadataPass());
     });
Index: llvm/trunk/lib/Target/AMDGPU/AMDGPU.h
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPU.h
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPU.h
@@ -93,7 +93,7 @@
 ModulePass *createAMDGPUOpenCLImageTypeLoweringPass();
 FunctionPass *createAMDGPUAnnotateUniformValues();
 
-FunctionPass* createAMDGPUUnifyMetadataPass();
+ModulePass* createAMDGPUUnifyMetadataPass();
 void initializeAMDGPUUnifyMetadataPass(PassRegistry&);
 extern char &AMDGPUUnifyMetadataID;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29189.86059.patch
Type: text/x-patch
Size: 3196 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170127/f07e0b17/attachment.bin>


More information about the llvm-commits mailing list