diff options
author | OCHyams <orlando.hyams@sony.com> | 2023-02-23 15:50:51 +0000 |
---|---|---|
committer | OCHyams <orlando.hyams@sony.com> | 2023-02-23 16:16:02 +0000 |
commit | 258c806b41251f66043a7d8636deae1a649fe6cb (patch) | |
tree | 68bca808127ab45eeffd2ebe1b3b37baa10c7e85 /llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | |
parent | 68b56e3a74706b1a63a38b8f45c50b10c82ba640 (diff) | |
download | llvm-258c806b41251f66043a7d8636deae1a649fe6cb.zip llvm-258c806b41251f66043a7d8636deae1a649fe6cb.tar.gz llvm-258c806b41251f66043a7d8636deae1a649fe6cb.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp index 1b9740a..0b51382 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) { |