[all-commits] [llvm/llvm-project] 0b71d8: [InstrRef][NFC] Avoid un-necessary DenseMap querie...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Wed Jul 17 03:25:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b71d8020f1181c75c305d34943ed42bb1948177
      https://github.com/llvm/llvm-project/commit/0b71d8020f1181c75c305d34943ed42bb1948177
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2024-07-17 (Wed, 17 Jul 2024)

  Changed paths:
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h

  Log Message:
  -----------
  [InstrRef][NFC] Avoid un-necessary DenseMap queries (#99048)

This patch adjusts how some data is stored to avoid a number of
un-necessary DenseMap queries. There's no change to the compiler
behaviour, and it's measurably faster on the compile time tracker.

The BlockOrders vector in buildVLocValueMap collects the blocks over
which a variables value have to be determined: however the Cmp ordering
function makes two DenseMap queries to determine the RPO-order of blocks
being compared. And given that sorting is O(N log(N)) comparisons this
isn't fast. So instead, fetch the RPO-numbers of the block collection,
order those, and then map back to the blocks themselves.

The OrderToBB collection mapped an RPO-number to an MBB: it's completely
un-necessary to have DenseMap here, we can just use the RPO number as an
array index. Switch it to a SmallVector and deal with a few consequences
when iterating.

(And for good measure I've jammed in a couple of reserve calls).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list