aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
diff options
context:
space:
mode:
authorOCHyams <orlando.hyams@sony.com>2023-02-23 07:40:31 +0000
committerOCHyams <orlando.hyams@sony.com>2023-02-23 07:43:12 +0000
commitb9ae0b09810cc24d1a90520e07ba9ea17fdc54b1 (patch)
tree0dd3e906bb068e3a9d3129f31a408a369a979901 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
parent686cff17cc310884e48ae963bf7507f96950cc90 (diff)
downloadllvm-b9ae0b09810cc24d1a90520e07ba9ea17fdc54b1.zip
llvm-b9ae0b09810cc24d1a90520e07ba9ea17fdc54b1.tar.gz
llvm-b9ae0b09810cc24d1a90520e07ba9ea17fdc54b1.tar.bz2
[Assignment Tracking] Initialise maps with minimum required number of entries
The size lower bound is known - the `Join` map in both cases gets an entry for each variable from both input maps (union). This reduces the number of times the map grows, improving ReleaseLTO-g compile time for CTMark projects by an average of around 0.2%. Reviewed By: scott.linder Differential Revision: https://reviews.llvm.org/D144486
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r--llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index d3c9d14..1b9740a 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1612,7 +1612,7 @@ AssignmentTrackingLowering::joinLocMap(const LocMap &A, const LocMap &B) {
// then adding LocKind::None elements for vars in A xor B. The latter part is
// equivalent to performing join on elements with variables in A xor B with
// LocKind::None (⊤) since join(x, ⊤) = ⊤.
- LocMap Join;
+ LocMap Join(std::max(A.size(), B.size()));
SmallVector<VariableID, 16> SymmetricDifference;
// Insert the join of the elements with common vars into Join. Add the
// remaining elements to into SymmetricDifference.
@@ -1703,7 +1703,7 @@ AssignmentTrackingLowering::joinAssignmentMap(const AssignmentMap &A,
// then adding LocKind::None elements for vars in A xor B. The latter part is
// equivalent to performing join on elements with variables in A xor B with
// Status::NoneOrPhi (⊤) since join(x, ⊤) = ⊤.
- AssignmentMap Join;
+ AssignmentMap Join(std::max(A.size(), B.size()));
SmallVector<VariableID, 16> SymmetricDifference;
// Insert the join of the elements with common vars into Join. Add the
// remaining elements to into SymmetricDifference.