[PATCH] D145512: [Assignment Tracking][NFC] Reuse BlockInfo rather than re-allocating each in iteration
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 08:38:07 PST 2023
Orlando updated this revision to Diff 503065.
Orlando added a comment.
Format and add context.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145512/new/
https://reviews.llvm.org/D145512
Files:
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
Index: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
===================================================================
--- llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1034,6 +1034,11 @@
return LiveLoc.size() == DebugValue.size() &&
LiveLoc.size() == StackHomeValue.size();
}
+ void clear() {
+ StackHomeValue.clear();
+ DebugValue.clear();
+ LiveLoc.clear();
+ }
};
Function &Fn;
@@ -1082,7 +1087,8 @@
static Assignment joinAssignment(const Assignment &A, const Assignment &B);
static AssignmentMap joinAssignmentMap(const AssignmentMap &A,
const AssignmentMap &B);
- static BlockInfo joinBlockInfo(const BlockInfo &A, const BlockInfo &B);
+ static void joinBlockInfo(BlockInfo &Result, const BlockInfo &A,
+ const BlockInfo &B);
///@}
/// Process the instructions in \p BB updating \p LiveSet along the way. \p
@@ -1746,15 +1752,14 @@
return Join;
}
-AssignmentTrackingLowering::BlockInfo
-AssignmentTrackingLowering::joinBlockInfo(const BlockInfo &A,
- const BlockInfo &B) {
- BlockInfo Join;
+void AssignmentTrackingLowering::joinBlockInfo(BlockInfo &Join,
+ const BlockInfo &A,
+ const BlockInfo &B) {
+ Join.clear();
Join.LiveLoc = joinLocMap(A.LiveLoc, B.LiveLoc);
Join.StackHomeValue = joinAssignmentMap(A.StackHomeValue, B.StackHomeValue);
Join.DebugValue = joinAssignmentMap(A.DebugValue, B.DebugValue);
assert(Join.isValid());
- return Join;
}
bool AssignmentTrackingLowering::join(
@@ -1800,7 +1805,8 @@
assert(VisitedPreds.size() > 1);
const BlockInfo &PredLiveOut0 = LiveOut.find(VisitedPreds[0])->second;
const BlockInfo &PredLiveOut1 = LiveOut.find(VisitedPreds[1])->second;
- BlockInfo BBLiveIn = joinBlockInfo(PredLiveOut0, PredLiveOut1);
+ BlockInfo BBLiveIn;
+ joinBlockInfo(BBLiveIn, PredLiveOut0, PredLiveOut1);
ArrayRef Tail = [&]() {
auto *It = VisitedPreds.begin();
@@ -1813,7 +1819,7 @@
const auto &PredLiveOut = LiveOut.find(Pred);
assert(PredLiveOut != LiveOut.end() &&
"block should have been processed already");
- BBLiveIn = joinBlockInfo(std::move(BBLiveIn), PredLiveOut->second);
+ joinBlockInfo(BBLiveIn, std::move(BBLiveIn), PredLiveOut->second);
}
// Save the joined result for BB.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145512.503065.patch
Type: text/x-patch
Size: 2537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230307/ef626b9a/attachment.bin>
More information about the llvm-commits
mailing list