[PATCH] D148022: [LegacyPM] Call getPassName only when needed
Alexis Engelke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 12 09:36:18 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG63a8ca3fe97d: [LegacyPM] Call getPassName only when needed (authored by aengelke).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148022/new/
https://reviews.llvm.org/D148022
Files:
llvm/lib/IR/LegacyPassManager.cpp
Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -1414,7 +1414,10 @@
FunctionPass *FP = getContainedPass(Index);
bool LocalChanged = false;
- llvm::TimeTraceScope PassScope("RunPass", FP->getPassName());
+ // Call getPassName only when required. The call itself is fairly cheap, but
+ // still virtual and repeated calling adds unnecessary overhead.
+ llvm::TimeTraceScope PassScope(
+ "RunPass", [FP]() { return std::string(FP->getPassName()); });
dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
dumpRequiredSet(FP);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148022.512873.patch
Type: text/x-patch
Size: 715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230412/7ba96453/attachment.bin>
More information about the llvm-commits
mailing list