[all-commits] [llvm/llvm-project] e0b11c: [Support][NFC] Fix generic `ChildrenGetterTy` of `...

zero9178 via All-commits all-commits at lists.llvm.org
Sun Jan 30 13:09:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e0b11c7659f81a382a3c76e26ed792308248f41c
      https://github.com/llvm/llvm-project/commit/e0b11c7659f81a382a3c76e26ed792308248f41c
  Author: Markus Böck <markus.boeck02 at gmail.com>
  Date:   2022-01-30 (Sun, 30 Jan 2022)

  Changed paths:
    M clang/include/clang/Analysis/Analyses/Dominators.h
    M clang/include/clang/Analysis/CFG.h
    M llvm/include/llvm/Support/GenericIteratedDominanceFrontier.h
    M llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

  Log Message:
  -----------
  [Support][NFC] Fix generic `ChildrenGetterTy` of `IDFCalculatorBase`

Both IDFCalculatorBase and its accompanying DominatorTreeBase only supports pointer nodes. The template argument is the block type itself and any uses of GraphTraits is therefore done via a pointer to the node type.
However, the ChildrenGetterTy type of IDFCalculatorBase has a use on just the node type instead of a pointer to the node type. Various parts of the monorepo has worked around this issue by providing specializations of GraphTraits for the node type directly, or not been affected by using specializations instead of the generic case. These are unnecessary however and instead the generic code should be fixed instead.

An example from within Tree is eg. A use of IDFCalculatorBase in InstrRefBasedImpl.cpp. It basically instantiates a IDFCalculatorBase<MachineBasicBlock, false> but due to the bug above then goes on to specialize GraphTraits<MachineBasicBlock> although GraphTraits<MachineBasicBlock*> exists (and should be used instead).

Similar dead code exists in clang which defines redundant GraphTraits to work around this bug.

This patch fixes both the original issue and removes the dead code that was used to work around the issue.

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




More information about the All-commits mailing list