[all-commits] [llvm/llvm-project] 719557: [SSAUpdater] Add a SmallPtrSet reserve method for ...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Thu Aug 8 03:36:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 719557269e9f5206d954c87ef0cb3d9abdf49946
      https://github.com/llvm/llvm-project/commit/719557269e9f5206d954c87ef0cb3d9abdf49946
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2024-08-08 (Thu, 08 Aug 2024)

  Changed paths:
    M llvm/include/llvm/ADT/SmallPtrSet.h
    M llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h
    M llvm/unittests/ADT/SmallPtrSetTest.cpp

  Log Message:
  -----------
  [SSAUpdater] Add a SmallPtrSet reserve method for IDFcalc (#97823)

As per the LLVM programmers manual, SmallPtrSets do linear scans on
insertion and then turn into a hash-table if the set gets big. Here in
the IDFCalculator, the SmallPtrSets have been configured to have 32
elements in each static allocation... which means that we linearly scan
for all problems with up to 32 elements, which I feel is quite a large
N.

Shorten the SmallPtrSet size, and add a reserve method to avoid any
repeated allocations, plus corresponding unit tests. Doing this yields a
0.13% compile-time improvement for debug-info builds, as we hit
IDFCalculator pretty hard in InstrRefBasedLDV.



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