[PATCH] D144621: [Assignment Tracking][NFC] Avoid doing some work when maps have same keys

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 02:54:50 PST 2023


StephenTozer accepted this revision.
StephenTozer added a comment.
This revision is now accepted and ready to land.

Small suggestion below, but LGTM with or without it.



================
Comment at: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp:1634
+  // Check if B can possibly contain variables not in A.
+  if (!SymmetricDifference.empty() || A.size() != B.size()) {
+    // Add the elements in B with variables that are not in A into
----------------
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144621/new/

https://reviews.llvm.org/D144621



More information about the llvm-commits mailing list