[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
Fri Feb 24 06:30:11 PST 2023


Orlando created this revision.
Orlando added reviewers: jmorse, StephenTozer, scott.linder.
Herald added a subscriber: hiraditya.
Herald added a project: All.
Orlando requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Restructure `AssignmentTrackingLowering::join` to avoid a map copy in the case where `BB` has more than one pred.

We only need to perform a copy of a pred `LiveOut` if there's exactly one already-visited pred (`Result = PredLiveOut`). With more than one pred the result is built by calling `Result = join(std::move(Result), PredLiveOut)` for each subsequent pred, where `join` parameters are `const &`. i.e. with more than 1 pred we can avoid copying by referencing the first two pred `LiveOut`s in the first `join` and then using a move + reference for the rest.

This gives marginal gains in compile time for CTMark LTO-g builds (geomean reduction of 0.05% instructions retired).


https://reviews.llvm.org/D144732

Files:
  llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D144732.500179.patch
Type: text/x-patch
Size: 4269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230224/cb6b7d84/attachment.bin>


More information about the llvm-commits mailing list