This is an archive of the discontinued LLVM Phabricator instance.

[Assignment Tracking][NFC] Avoid doing some work when maps have same keys
ClosedPublic

Authored by Orlando on Feb 23 2023, 12:19 AM.

Details

Summary

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)

Diff Detail

Event Timeline

Orlando created this revision.Feb 23 2023, 12:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 12:19 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
Orlando requested review of this revision.Feb 23 2023, 12:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 23 2023, 12:19 AM
StephenTozer accepted this revision.Feb 23 2023, 2:54 AM

Small suggestion below, but LGTM with or without it.

llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
1644

I think this (and the check below) could be alternatively implemented as if (SymmetricDifference.empty() && A.size() == B.size()) return Join;, since the only thing left in the function outside of this block is the asserts which look to trivially always hold if this block isn't executed - but just a suggestion, if you disagree then no issues merging.

This revision is now accepted and ready to land.Feb 23 2023, 2:54 AM
This revision was landed with ongoing or failed builds.Feb 23 2023, 8:16 AM
This revision was automatically updated to reflect the committed changes.
Orlando added inline comments.Feb 23 2023, 8:16 AM
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
1644

Done! Thanks.