[all-commits] [llvm/llvm-project] 848a68: DomTree: Extract (mostly) read-only logic into typ...

Nicolai Hähnle via All-commits all-commits at lists.llvm.org
Tue Oct 20 10:53:41 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 848a68a032d1c59274526abb3220714202d4757e
      https://github.com/llvm/llvm-project/commit/848a68a032d1c59274526abb3220714202d4757e
  Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
  Date:   2020-10-20 (Tue, 20 Oct 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineDominators.h
    M llvm/include/llvm/Support/GenericDomTree.h
    M llvm/include/llvm/Support/GenericDomTreeConstruction.h
    M llvm/lib/Support/CMakeLists.txt
    A llvm/lib/Support/GenericDomTree.cpp
    M llvm/lib/Transforms/Scalar/ADCE.cpp
    M llvm/lib/Transforms/Scalar/NewGVN.cpp

  Log Message:
  -----------
  DomTree: Extract (mostly) read-only logic into type-erased base classes

Avoid having to instantiate and compile a subset of the dominator tree logic
separately for each node type. More importantly, this allows generic
algorithms to be built on top of dominator trees without writing them as
templates -- such algorithms can now use opaque CfgBlockRef and
CfgInterface instead.

A type-erased implementation of dominator trees could be written in
terms of CfgInterface as well, but doing so would change the current
trade-off: it would slightly reduce code size at the cost of a slight
runtime overhead.

This patch does not change the trade-off, as it only does type-erasure
where basic blocks can be treated in a fully opaque way, i.e. it only
moves methods that don't require iteration over CFG successors and
predecessors.

v5:
- rename generic_{begin,end,children} back without the generic_ prefix
  and refer explictly to base class methods in NewGVN, which wants to
  mutate the order of dominator tree node children directly

v6:
- style change: iDom -> idom; it's arguable whether this is really
  invalid, since it is actually standard camelCase, but clang-tidy
  complains about it so... *shrug*
- rename {to,from}Generic -> {wrap,unwrap}Ref

Change-Id: Ib860dc04cf8bb093d8ed00be7def40d662213672

Differential Revision: https://reviews.llvm.org/D83089




More information about the All-commits mailing list