[PATCH] D83089: DomTree: Extract (mostly) read-only logic into type-erased base classes

Nicolai Hähnle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 14:36:16 PDT 2020


nhaehnle created this revision.
nhaehnle added reviewers: arsenm, RKSimon, mehdi_amini, courbet.
Herald added subscribers: mgrang, hiraditya, mgorny, wdng.
Herald added a project: LLVM.
nhaehnle added a parent revision: D83088: Introduce CfgTraits abstraction.
nhaehnle added a child revision: D83090: DomTree: Add TreeNode type alias.

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.

Change-Id: Ib860dc04cf8bb093d8ed00be7def40d662213672


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83089

Files:
  llvm/include/llvm/CodeGen/MachineDominators.h
  llvm/include/llvm/Support/GenericDomTree.h
  llvm/include/llvm/Support/GenericDomTreeConstruction.h
  llvm/lib/Support/CMakeLists.txt
  llvm/lib/Support/GenericDomTree.cpp
  llvm/lib/Transforms/Scalar/ADCE.cpp
  llvm/lib/Transforms/Scalar/NewGVN.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83089.275232.patch
Type: text/x-patch
Size: 43456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200702/4c70ce68/attachment-0001.bin>


More information about the llvm-commits mailing list