[all-commits] [llvm/llvm-project] 4d1ebe: [GVN] Reorganise GVN.h/GVH.cpp to improve readabil...

Momchil Velikov via All-commits all-commits at lists.llvm.org
Tue Jul 21 08:43:22 PDT 2026


  Branch: refs/heads/users/momchil-velikov/gvn-reorganize-src
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d1ebeb7db966e149ad111fd325000a6cbdb3235
      https://github.com/llvm/llvm-project/commit/4d1ebeb7db966e149ad111fd325000a6cbdb3235
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2026-07-21 (Tue, 21 Jul 2026)

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

  Log Message:
  -----------
  [GVN] Reorganise GVN.h/GVH.cpp to improve readability and maintainability (NFC)

Over the years GVN.h/GVN.cpp has grown in size and complexity, and the order of
member functions and definitions has become somewhat arbitrary. This commit
reorganises the code to improve readability and maintainability.

* in `GVNPass` class, put private member variables first, followed by public
  member functions, and then private member functions
* in `GVNPass` class: private type definitions are placed in front of the
  logically related member variables (except `ValueTable` which need to be
  public)
* definitions of `GVNPass::ValueTable` methods are grouped and reordered to
  match the order of their declarations
* The following `GVNPass` member functions were made `private` and `LLVM_API`
  removed: `getDominatorTree`, `getAliasAnalysis`, `getMemDep`,
  `isScalarPREEnabled`, `isLoadPREEnabled`, `isLoadInLoopPREEnabled`,
  `isLoadPRESplitBackedgeEnabled`,  `isMemDepEnabled`,  `isMemorySSAEnabled`,
  and `salvageAndRemoveInstruction`
* `constructSSAForLoadSet` changed to take a `Dominator &`, in order to not
  require access to the (now) private `getDominatorTree`
* member functions of `GVNPass` rearranged into a more logical order:
  - starting with the main pass entry pount (`runImpl`) put utility member
  functions in front of their callers, in order of calling (where it matters),
  for example `runImpl` -> `iterateOnFunction` -> `perfromPRE`
  - group functions of the same "theme" together, for example
  `iterateOnFunction` +  `processBlock` +  `processInstrution`, or another
  example, `performLoadPRE` + `performLoopLoadPRE`
  - put miscelaneous helper member functions at the end
* rearrange definitions in `GVN.cpp` to match the order of declarations in
  `GVN.h`
* place `static` helper functions close and in front of their callers



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