[llvm] Add option to dump IR to files instead of stderr (PR #66412)

Sebastian Neubauer via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 02:39:37 PDT 2023


================
@@ -684,9 +686,56 @@ PrintIRInstrumentation::~PrintIRInstrumentation() {
   assert(ModuleDescStack.empty() && "ModuleDescStack is not empty at exit");
 }
 
-void PrintIRInstrumentation::pushModuleDesc(StringRef PassID, Any IR) {
+static SmallString<32> getIRFileDisplayName(Any IR) {
+  SmallString<32> Result;
+  raw_svector_ostream ResultStream(Result);
   const Module *M = unwrapModule(IR);
-  ModuleDescStack.emplace_back(M, getIRName(IR), PassID);
+  ResultStream << stable_hash_combine_string(M->getName());
----------------
Flakebi wrote:

I suppose it makes sense to format the hashes as hex, so every filename has the same length

https://github.com/llvm/llvm-project/pull/66412


More information about the llvm-commits mailing list