Index: llvm/lib/Passes/StandardInstrumentations.cpp =================================================================== --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -19,6 +19,7 @@ #include "llvm/Analysis/CallGraphSCCPass.h" #include "llvm/Analysis/LazyCallGraph.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/Analysis/LoopNestAnalysis.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" #include "llvm/IR/Module.h" @@ -290,6 +291,15 @@ return OS.str(); } + if (any_isa(IR)) { + const Loop *L = &any_cast(IR)->getOutermostLoop(); + std::string S; + raw_string_ostream OS(S); + assert(L && "Loop should be valid for printing"); + L->print(OS, /*Verbose*/ false, /*PrintNested*/ false); + return OS.str(); + } + llvm_unreachable("Unknown wrapped IR type"); } @@ -858,7 +868,11 @@ if (!ShouldRun && DebugLogging) { errs() << "Skipping pass " << PassID << " on " << F->getName() << " due to optnone attribute\n"; + } else if (any_isa(IR)) { + const Loop *L = &any_cast(IR)->getOutermostLoop(); + F = L->getHeader()->getParent(); } + return ShouldRun; }