[llvm] 258c806 - [Assignment Tracking][NFC] Avoid doing some work when maps have same keys
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 08:16:22 PST 2023
Author: OCHyams
Date: 2023-02-23T16:16:02Z
New Revision: 258c806b41251f66043a7d8636deae1a649fe6cb
URL: https://github.com/llvm/llvm-project/commit/258c806b41251f66043a7d8636deae1a649fe6cb
DIFF: https://github.com/llvm/llvm-project/commit/258c806b41251f66043a7d8636deae1a649fe6cb.diff
LOG: [Assignment Tracking][NFC] Avoid doing some work when maps have same keys
Where the new checks have been added, `SymmetricDifference` - still being built
- contains entries for variables present in `A` and not in `B`. If
`SymmetricDifference` is empty at this point it means the variables (map keys)
in `A` are a subset of those in `B`, so if `A` and `B` are the same size then
we know they're identical.
This reduces the number of instructions retired building some of the CTMark
projects in a ReleaseLTO-g configuration (geomean change -0.05% with the best
improvement being -0.24% for tramp3d-v4)
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D144621
Added:
Modified:
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 1b9740a5003b..0b513823b134 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -1630,6 +1630,10 @@ AssignmentTrackingLowering::joinLocMap(const LocMap &A, const LocMap &B) {
unsigned IntersectSize = Join.size();
(void)IntersectSize;
+ // Check if A and B contain the same variables.
+ if (SymmetricDifference.empty() && A.size() == B.size())
+ return Join;
+
// Add the elements in B with variables that are not in A into
// SymmetricDifference.
for (const auto &Pair : B) {
@@ -1721,6 +1725,10 @@ AssignmentTrackingLowering::joinAssignmentMap(const AssignmentMap &A,
unsigned IntersectSize = Join.size();
(void)IntersectSize;
+ // Check if A and B contain the same variables.
+ if (SymmetricDifference.empty() && A.size() == B.size())
+ return Join;
+
// Add the elements in B with variables that are not in A into
// SymmetricDifference.
for (const auto &Pair : B) {
More information about the llvm-commits
mailing list