[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 02:19:48 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
aengelke marked an inline comment as done.
Closed by commit rGa2e596bdf8cc: [LegacyPM] Reduce number of calls to getName (authored by aengelke).
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.513126.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/5611d0e1/attachment.bin>
More information about the llvm-commits
mailing list