[all-commits] [llvm/llvm-project] 932f71: [GVN] Decouple GVNValueTable and GVNPass (NFC)

Momchil Velikov via All-commits all-commits at lists.llvm.org
Thu Sep 24 09:54:26 PDT 2026


  Branch: refs/heads/users/momchil-velikov/gvn-decouple-value-table
  Home:   https://github.com/llvm/llvm-project
  Commit: 932f71c77b2f1abf73749bc2647482ea24bc4c85
      https://github.com/llvm/llvm-project/commit/932f71c77b2f1abf73749bc2647482ea24bc4c85
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Transforms/Scalar/GVN.h
    M llvm/lib/Transforms/Scalar/GVN.cpp

  Log Message:
  -----------
  [GVN] Decouple GVNValueTable and GVNPass (NFC)

This is a first patch in series with the ultimate goal to move `GVNPass`
out of `GVN.h` and into `GVN.cpp.`

This is not straightforward because because of the rather tangled
dependencies between `GVNPass`, `GVNHoistPass`, `ValueTable`,
and `LeaderMap`.

The `GVNHoistPass` pass references `GVNPass::ValueTable`, by peeking
into `GVNPass`, resp. including `GVN.h`. Since `GVNHoistPass` does not
actually depend on `GVNPass` itself, but only on the `ValueTable` it
contains, it would make more sense to move `ValueTable` out of `GVN.h`
to its own header file, to be included by both `GVN.h` and
`GVNHoist.cpp.`

That's not entirely straightforward either since `ValueTable` has
several member functions taking a `GVNPass` reference as an argument.
This prevents moving `GVNPass` out of `GVN.h` and into an anonymous
namespace in `GVN.cpp`.

These `GVNPass` (in `ValueTable`) references are only used to access
the `LeaderMap`. Consequently, `LeaderMap` can be moved out of `GVNPass`
and into the `llvm` namespace and forward declared for its uses by
`ValueTable` (when `ValueTable` gets its own header).

This patch moves the `LeaderMap` out of `GVNPass`, into the `llvm`
namespace, and renames it to `GVNLeaderMap`.



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