[PATCH] D18616: [NVPTX] Move NVVMReflect pass out of codegen passes.

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 12:01:15 PDT 2016


jlebar updated this revision to Diff 55278.
jlebar added a comment.

Still run NVVMReflect at the start of the target-specific passes, since it's necessary for correctness.


http://reviews.llvm.org/D18616

Files:
  lib/Target/NVPTX/NVPTXTargetMachine.cpp
  lib/Target/NVPTX/NVPTXTargetMachine.h

Index: lib/Target/NVPTX/NVPTXTargetMachine.h
===================================================================
--- lib/Target/NVPTX/NVPTXTargetMachine.h
+++ lib/Target/NVPTX/NVPTXTargetMachine.h
@@ -61,6 +61,7 @@
     return TLOF.get();
   }
 
+  void addEarlyAsPossiblePasses(PassManagerBase &PM) override;
   TargetIRAnalysis getTargetIRAnalysis() override;
 
 }; // NVPTXTargetMachine.
Index: lib/Target/NVPTX/NVPTXTargetMachine.cpp
===================================================================
--- lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -167,6 +167,10 @@
   return new NVPTXPassConfig(this, PM);
 }
 
+void NVPTXTargetMachine::addEarlyAsPossiblePasses(PassManagerBase &PM) {
+  PM.add(createNVVMReflectPass());
+}
+
 TargetIRAnalysis NVPTXTargetMachine::getTargetIRAnalysis() {
   return TargetIRAnalysis([this](const Function &F) {
     return TargetTransformInfo(NVPTXTTIImpl(this, F));
@@ -229,7 +233,12 @@
   disablePass(&FuncletLayoutID);
   disablePass(&PatchableFunctionID);
 
+  // NVVMReflectPass is added in addEarlyAsPossiblePasses, so hopefully running
+  // it here does nothing.  But since we need it for correctness when lowering
+  // to NVPTX, run it here too, in case whoever built our pass pipeline didn't
+  // call addEarlyAsPossiblePasses.
   addPass(createNVVMReflectPass());
+
   if (getOptLevel() != CodeGenOpt::None)
     addPass(createNVPTXImageOptimizerPass());
   addPass(createNVPTXAssignValidGlobalNamesPass());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18616.55278.patch
Type: text/x-patch
Size: 1503 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160427/466de947/attachment.bin>


More information about the llvm-commits mailing list