[llvm] c621350 - [Pass] Support MachineFunction in getIRName (#70901)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 23:19:07 PST 2023


Author: paperchalice
Date: 2023-11-08T16:19:02+09:00
New Revision: c6213506974a2aa3e81e6ea279511b996827910d

URL: https://github.com/llvm/llvm-project/commit/c6213506974a2aa3e81e6ea279511b996827910d
DIFF: https://github.com/llvm/llvm-project/commit/c6213506974a2aa3e81e6ea279511b996827910d.diff

LOG: [Pass] Support MachineFunction in getIRName (#70901)

It is necessary in MachinePassManager. `llc` can show function names
when using `debug-pass-manager`.
Part of #69879.
@arsenm

Added: 
    

Modified: 
    llvm/lib/Passes/StandardInstrumentations.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 06cc58c0219632d..8cae1235487f13b 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/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/CodeGen/MachineFunction.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Module.h"
@@ -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");
 }
 


        


More information about the llvm-commits mailing list