This is a plain and simple performance patch: InstrRefBasedLDV passes uses three distinct DenseMaps when calculating what variable values are in a block: two "long term" dense maps, and one "working" dense map. The live-ins are:
- Placed into the working set, as vlocJoin works out what each variables value should be,
- Copied into the "long term" live-in storage back in buildVLocValueMap,
- The working set has its values updated by the blocks transfer function,
- The working set is copied into the blocks live-out DenseMap.
This works well enough, but it involves two dense map comparisons and two dense map assignments, when each of the live-in / live-out dense maps are updated. For scopes with a small number of variables, this can take a large amount of time, seeing how (I think?) the initial DenseMap allocation is 64 elements. We could pay with SmallDenseMaps, however instead, lets just reduce the total number of densemaps. We can update live-ins and live-outs in-place, as appropriate, avoiding the comparisons and copies.
Practically, this means passing fewer bits of information around. Every time we make an assignment to a live-in or live-out because vlocJoin (or the transfer function) has changed it, we have to do an explicit comparison to see whether we're changing the value. Otherwise, everything works as before.
This claws back another slice of performance: http://llvm-compile-time-tracker.com/compare.php?from=bc07cf76a31fa769786d6631fe25586bd1396c34&to=231cbb7cbd13e01cf81fa97db441582af2efbbb7&stat=instructions