[all-commits] [llvm/llvm-project] 3bdf9a: [EquivalenceClasses] Use SmallVector for determini...

Florian Hahn via All-commits all-commits at lists.llvm.org
Wed Apr 2 12:28:05 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3bdf9a08804a5b424fd32fef3b0089f3a6db839d
      https://github.com/llvm/llvm-project/commit/3bdf9a08804a5b424fd32fef3b0089f3a6db839d
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2025-04-02 (Wed, 02 Apr 2025)

  Changed paths:
    M clang/lib/Analysis/FlowSensitive/SimplifyConstraints.cpp
    M llvm/include/llvm/ADT/EquivalenceClasses.h
    M llvm/lib/Analysis/VectorUtils.cpp
    M llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUSplitModule.cpp
    M llvm/lib/Transforms/IPO/LowerTypeTests.cpp
    M llvm/lib/Transforms/Scalar/Float2Int.cpp
    M llvm/lib/Transforms/Scalar/LoopDistribute.cpp
    M llvm/lib/Transforms/Utils/SplitModule.cpp
    M llvm/test/CodeGen/WebAssembly/cfi.ll
    M llvm/test/TableGen/GlobalISelCombinerEmitter/type-inference.td
    M llvm/test/Transforms/LowerTypeTests/function-disjoint.ll
    M llvm/test/Transforms/LowerTypeTests/nonstring.ll
    M llvm/test/tools/llvm-split/preserve-locals.ll
    M llvm/test/tools/llvm-split/scc-const-alias.ll
    M llvm/test/tools/llvm-split/scc-global-alias.ll
    M llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp

  Log Message:
  -----------
  [EquivalenceClasses] Use SmallVector for deterministic iteration order. (#134075)

Currently iterators over EquivalenceClasses will iterate over std::set,
which guarantees the order specified by the comperator. Unfortunately in
many cases, EquivalenceClasses are used with pointers, so iterating over
std::set of pointers will not be deterministic across runs.

There are multiple places that explicitly try to sort the equivalence
classes before using them to try to get a deterministic order
(LowerTypeTests, SplitModule), but there are others that do not at the
moment and this can result at least in non-determinstic value naming in
Float2Int.

This patch updates EquivalenceClasses to keep track of all members via a
extra SmallVector and removes code from LowerTypeTests and SplitModule
to sort the classes before processing.

Overall it looks like compile-time slightly decreases in most cases, but
close to noise:

https://llvm-compile-time-tracker.com/compare.php?from=7d441d9892295a6eb8aaf481e1715f039f6f224f&to=b0c2ac67a88d3ef86987e2f82115ea0170675a17&stat=instructions

PR: https://github.com/llvm/llvm-project/pull/134075



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