Index: tools/opt/Debugify.cpp =================================================================== --- tools/opt/Debugify.cpp +++ tools/opt/Debugify.cpp @@ -126,6 +126,7 @@ bool checkDebugifyMetadata(Module &M, iterator_range Functions, + StringRef AttachedPassName, StringRef Banner, bool Strip) { // Skip modules without debugify metadata. @@ -190,7 +191,8 @@ outs() << "ERROR: Missing variable " << Idx + 1 << "\n"; HasErrors |= MissingVars.count() > 0; - outs() << Banner << (HasErrors ? "FAIL" : "PASS") << '\n'; + outs() << Banner << " [" << AttachedPassName << "]: " + << (HasErrors ? "FAIL" : "PASS") << '\n'; if (HasErrors) { outs() << "Module IR Dump\n"; M.print(outs(), nullptr, false); @@ -245,16 +247,21 @@ /// legacy module pass manager. struct CheckDebugifyModulePass : public ModulePass { bool runOnModule(Module &M) override { - return checkDebugifyMetadata(M, M.functions(), "CheckModuleDebugify: ", - Strip); + return checkDebugifyMetadata(M, M.functions(), AttachedPassName, + "CheckModuleDebugify", Strip); } - CheckDebugifyModulePass(bool Strip = false) : ModulePass(ID), Strip(Strip) {} + CheckDebugifyModulePass(bool Strip = false, + StringRef AttachedPassName = "") + : ModulePass(ID), + Strip(Strip), + AttachedPassName(AttachedPassName) {} static char ID; // Pass identification. private: bool Strip; + StringRef AttachedPassName; }; /// FunctionPass for checking debug info inserted by -debugify-function, used @@ -264,10 +271,14 @@ Module &M = *F.getParent(); auto FuncIt = F.getIterator(); return checkDebugifyMetadata(M, make_range(FuncIt, std::next(FuncIt)), - "CheckFunctionDebugify: ", Strip); + AttachedPassName, "CheckFunctionDebugify", Strip); } - CheckDebugifyFunctionPass(bool Strip = false) : FunctionPass(ID), Strip(Strip) {} + CheckDebugifyFunctionPass(bool Strip = false, + StringRef AttachedPassName = "") + : FunctionPass(ID), + Strip(Strip), + AttachedPassName(AttachedPassName) {} void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesAll(); @@ -277,6 +288,7 @@ private: bool Strip; + StringRef AttachedPassName; }; } // end anonymous namespace @@ -294,17 +306,19 @@ return PreservedAnalyses::all(); } -ModulePass *createCheckDebugifyModulePass(bool Strip) { - return new CheckDebugifyModulePass(Strip); +ModulePass *createCheckDebugifyModulePass(bool Strip, StringRef AttachedPassName) { + return new CheckDebugifyModulePass(Strip, AttachedPassName); } -FunctionPass *createCheckDebugifyFunctionPass(bool Strip) { - return new CheckDebugifyFunctionPass(Strip); +FunctionPass *createCheckDebugifyFunctionPass(bool Strip, StringRef AttachedPassName) { + return new CheckDebugifyFunctionPass(Strip, AttachedPassName); } PreservedAnalyses NewPMCheckDebugifyPass::run(Module &M, - ModuleAnalysisManager &) { - checkDebugifyMetadata(M, M.functions(), "CheckModuleDebugify: ", false); + ModuleAnalysisManager &, + StringRef AttachedPassName) { + checkDebugifyMetadata(M, M.functions(), AttachedPassName, + "CheckModuleDebugify", false); return PreservedAnalyses::all(); } Index: tools/opt/PassPrinters.h =================================================================== --- tools/opt/PassPrinters.h +++ tools/opt/PassPrinters.h @@ -56,12 +56,15 @@ llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM); }; -llvm::ModulePass *createCheckDebugifyModulePass(bool Strip = false); -llvm::FunctionPass *createCheckDebugifyFunctionPass(bool Strip = false); +llvm::ModulePass *createCheckDebugifyModulePass(bool Strip = false, + llvm::StringRef AttachedPassName = ""); +llvm::FunctionPass *createCheckDebugifyFunctionPass(bool Strip = false, + llvm::StringRef AttachedPassName = ""); struct NewPMCheckDebugifyPass : public llvm::PassInfoMixin { - llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM); + llvm::PreservedAnalyses run(llvm::Module &M, llvm::ModuleAnalysisManager &AM, + llvm::StringRef AttachedPassName = ""); }; #endif // LLVM_TOOLS_OPT_PASSPRINTERS_H Index: tools/opt/opt.cpp =================================================================== --- tools/opt/opt.cpp +++ tools/opt/opt.cpp @@ -278,12 +278,12 @@ case PT_Function: super::add(createDebugifyFunctionPass()); super::add(P); - super::add(createCheckDebugifyFunctionPass(true)); + super::add(createCheckDebugifyFunctionPass(true, P->getPassName())); break; case PT_Module: super::add(createDebugifyModulePass()); super::add(P); - super::add(createCheckDebugifyModulePass(true)); + super::add(createCheckDebugifyModulePass(true, P->getPassName())); break; default: super::add(P);