[PATCH] D148145: [LegacyPM] Reduce number of calls to getName
Alexis Engelke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 00:42:53 PDT 2023
aengelke updated this revision to Diff 513087.
aengelke added a comment.
Make `Name` const.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148145/new/
https://reviews.llvm.org/D148145
Files:
llvm/lib/IR/LegacyPassManager.cpp
Index: llvm/lib/IR/LegacyPassManager.cpp
===================================================================
--- llvm/lib/IR/LegacyPassManager.cpp
+++ llvm/lib/IR/LegacyPassManager.cpp
@@ -1408,7 +1408,9 @@
FunctionSize = F.getInstructionCount();
}
- llvm::TimeTraceScope FunctionScope("OptFunction", F.getName());
+ // Store name outside of loop to avoid redundant calls.
+ const StringRef Name = F.getName();
+ llvm::TimeTraceScope FunctionScope("OptFunction", Name);
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
@@ -1419,7 +1421,7 @@
llvm::TimeTraceScope PassScope(
"RunPass", [FP]() { return std::string(FP->getPassName()); });
- dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getName());
+ dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, Name);
dumpRequiredSet(FP);
initializeAnalysisImpl(FP);
@@ -1458,7 +1460,7 @@
Changed |= LocalChanged;
if (LocalChanged)
- dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getName());
+ dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, Name);
dumpPreservedSet(FP);
dumpUsedSet(FP);
@@ -1466,7 +1468,7 @@
if (LocalChanged)
removeNotPreservedAnalysis(FP);
recordAvailableAnalysis(FP);
- removeDeadPasses(FP, F.getName(), ON_FUNCTION_MSG);
+ removeDeadPasses(FP, Name, ON_FUNCTION_MSG);
}
return Changed;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148145.513087.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/258b7d40/attachment.bin>
More information about the llvm-commits
mailing list