[all-commits] [llvm/llvm-project] 0cdacd: [DomTree] Fix root attachment in runDFS() (#73148)

Nikita Popov via All-commits all-commits at lists.llvm.org
Mon Dec 4 00:24:27 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0cdacd5f492991362bfc8e252673aafdb9651322
      https://github.com/llvm/llvm-project/commit/0cdacd5f492991362bfc8e252673aafdb9651322
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-12-04 (Mon, 04 Dec 2023)

  Changed paths:
    M llvm/include/llvm/Support/GenericDomTreeConstruction.h

  Log Message:
  -----------
  [DomTree] Fix root attachment in runDFS() (#73148)

Currently, runDFS() only sets the Parent of the DFS root if it is
already in the NodeToInfo map. This doesn't matter if we're running DFS
on the DT root, which doesn't have a parent anyway. However, when
running on PDT roots, this means we end up keeping the parent at 0,
rather than setting it to 1 for the virtual PDT root. Because the
virtual root (nullptr) has the same value as the dummy value in
NumToNode (nullptr) this happens to work out by accident right now.

I believe we should always be setting the parent in runDFS(), and adjust
AttachToNum in doFullDFSWalk() to be 1 (the virtual root) for PDTs.




More information about the All-commits mailing list