[PATCH] D144732: [Assignment Tracking] Elide a map copy in some cases

Orlando Cazalet-Hyams via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 01:59:03 PDT 2023


Orlando marked an inline comment as done.
Orlando added a comment.

Thanks!



================
Comment at: llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp:1778-1779
+  if (VisitedPreds.empty()) {
+    bool DidInsert = LiveIn.try_emplace(&BB, BlockInfo()).second;
+    return /*Changed*/ DidInsert;
+  }
----------------
jmorse wrote:
> To confirm my understanding: with no predecessors visited, there's no information in BlockInfo, and this attempts to place it in the live-in maps. If this block has already been visited then there can _only_ be an empty BlockInfo there already, so it's safe to use "try_emplace" and allow it to fail. Failure means the same BlockInfo is in the map, but we don't need to explore any further because there's been no change.
> 
> (I worry that try_emplace failing would cause exploration to cease too early, but if the above is true, then it's sound).
That's exactly right, yeah.


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

https://reviews.llvm.org/D144732



More information about the llvm-commits mailing list