Trass3r updated this revision to Diff 488959. Trass3r added a comment. I can only refer to my last comment, even in latest trunk that code is still active for the codegen passes. But meanwhile I found the corresponding new code.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135658/new/ https://reviews.llvm.org/D135658 Files: clang/test/Driver/check-time-trace-sections.py llvm/lib/IR/CMakeLists.txt llvm/lib/IR/LegacyPassManager.cpp llvm/lib/Passes/CMakeLists.txt llvm/lib/Passes/StandardInstrumentations.cpp
Index: llvm/lib/Passes/StandardInstrumentations.cpp =================================================================== --- llvm/lib/Passes/StandardInstrumentations.cpp +++ llvm/lib/Passes/StandardInstrumentations.cpp @@ -18,6 +18,7 @@ #include "llvm/Analysis/CallGraphSCCPass.h" #include "llvm/Analysis/LazyCallGraph.h" #include "llvm/Analysis/LoopInfo.h" +#include "llvm/Demangle/Demangle.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/LegacyPassManager.h" @@ -187,11 +188,11 @@ } std::string getIRName(Any IR) { - if (any_cast<const Module *>(&IR)) - return "[module]"; + if (const auto **M = any_cast<const Module *>(&IR)) + return (*M)->getModuleIdentifier(); if (const auto **F = any_cast<const Function *>(&IR)) - return (*F)->getName().str(); + return demangle((*F)->getName().str()); if (const auto **C = any_cast<const LazyCallGraph::SCC *>(&IR)) return (*C)->getName(); Index: llvm/lib/Passes/CMakeLists.txt =================================================================== --- llvm/lib/Passes/CMakeLists.txt +++ llvm/lib/Passes/CMakeLists.txt @@ -19,6 +19,7 @@ CodeGen Core Coroutines + Demangle IPO InstCombine IRPrinter Index: llvm/lib/IR/LegacyPassManager.cpp =================================================================== --- llvm/lib/IR/LegacyPassManager.cpp +++ llvm/lib/IR/LegacyPassManager.cpp @@ -12,6 +12,7 @@ #include "llvm/IR/LegacyPassManager.h" #include "llvm/ADT/MapVector.h" +#include "llvm/Demangle/Demangle.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" @@ -1408,7 +1409,8 @@ FunctionSize = F.getInstructionCount(); } - llvm::TimeTraceScope FunctionScope("OptFunction", F.getName()); + llvm::TimeTraceScope FunctionScope( + "OptFunction", [&F]() { return demangle(F.getName().str()); }); for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { FunctionPass *FP = getContainedPass(Index); Index: llvm/lib/IR/CMakeLists.txt =================================================================== --- llvm/lib/IR/CMakeLists.txt +++ llvm/lib/IR/CMakeLists.txt @@ -77,6 +77,7 @@ LINK_COMPONENTS BinaryFormat + Demangle Remarks Support TargetParser Index: clang/test/Driver/check-time-trace-sections.py =================================================================== --- clang/test/Driver/check-time-trace-sections.py +++ clang/test/Driver/check-time-trace-sections.py @@ -13,9 +13,12 @@ log_contents = json.loads(sys.stdin.read()) events = log_contents["traceEvents"] -codegens = [event for event in events if event["name"] == "CodeGen Function"] + +instants = [event for event in events if event["name"] == "InstantiateFunction"] +codegens = [event for event in events if event["name"] == "CodeGen Function"] +opts = [event for event in events if event["name"] == "OptFunction"] frontends = [event for event in events if event["name"] == "Frontend"] -backends = [event for event in events if event["name"] == "Backend"] +backends = [event for event in events if event["name"] == "Backend"] beginning_of_time = log_contents["beginningOfTime"] / 1000000 seconds_since_epoch = time.time() @@ -32,3 +35,11 @@ if not all([all([is_before(frontend, backend) for frontend in frontends]) for backend in backends]): sys.exit("Not all Frontend section are before all Backend sections!") + +# Check that entries for foo exist and are in a demangled form. +if not any(e for e in instants if "foo<int>" in e["args"]["detail"]): + sys.exit("Missing Instantiate entry for foo!") +if not any(e for e in codegens if "foo<int>" in e["args"]["detail"]): + sys.exit("Missing CodeGen entry for foo!") +if not any(e for e in opts if "foo<int>" in e["args"]["detail"]): + sys.exit("Missing Optimize entry for foo!")
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits