Skip to content

Commit

Permalink
[Pass] Support MachineFunction in getIRName (#70901)
Browse files Browse the repository at this point in the history
It is necessary in MachinePassManager. `llc` can show function names
when using `debug-pass-manager`.
Part of #69879.
@arsenm
  • Loading branch information
paperchalice committed Nov 8, 2023
1 parent 573fa77 commit c621350
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/Passes/StandardInstrumentations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "llvm/Analysis/CallGraphSCCPass.h"
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
Expand Down Expand Up @@ -222,6 +223,9 @@ std::string getIRName(Any IR) {
if (const auto **L = llvm::any_cast<const Loop *>(&IR))
return (*L)->getName().str();

if (const auto **MF = llvm::any_cast<const MachineFunction *>(&IR))
return (*MF)->getName().str();

llvm_unreachable("Unknown wrapped IR type");
}

Expand Down

0 comments on commit c621350

Please sign in to comment.