[llvm] Add option to dump IR to files intstead of stderr (PR #66412)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 23:26:08 PDT 2023
================
@@ -684,9 +686,64 @@ PrintIRInstrumentation::~PrintIRInstrumentation() {
assert(ModuleDescStack.empty() && "ModuleDescStack is not empty at exit");
}
-void PrintIRInstrumentation::pushModuleDesc(StringRef PassID, Any IR) {
+static SmallString<32> getIRDisplayName(Any IR) {
+
+ auto hashName = [](StringRef name) {
+ const size_t hashValue = hash_value(name);
+ return std::to_string(hashValue);
+ };
+
+ SmallString<32> Result;
+ const Module *M = unwrapModule(IR);
+ std::string ModuleName = hashName(M->getName());
+ SmallString<32> IRName;
----------------
arsenm wrote:
Use raw_svector_ostream?
https://github.com/llvm/llvm-project/pull/66412
More information about the llvm-commits
mailing list