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)); @@ -228,7 +232,6 @@ disablePass(&PostRASchedulerID); disablePass(&FuncletLayoutID); - addPass(createNVVMReflectPass()); if (getOptLevel() != CodeGenOpt::None) addPass(createNVPTXImageOptimizerPass()); addPass(createNVPTXAssignValidGlobalNamesPass());