[all-commits] [llvm/llvm-project] 174f80: [DomTree] Avoid duplicate hash lookups in runDFS()...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Jun 25 00:23:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 174f80c6030f9bc96df6ae8daeb4d6bce3f36fbb
      https://github.com/llvm/llvm-project/commit/174f80c6030f9bc96df6ae8daeb4d6bce3f36fbb
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

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

  Log Message:
  -----------
  [DomTree] Avoid duplicate hash lookups in runDFS() (NFCI) (#96460)

runDFS() currently performs three hash table lookups. One in the main
loop, one when checking whether a successor has already been visited and
another when adding parent and reverse children to the successor.

We can avoid the two additional lookups by making the parent number part
of the stack, and then making the parent / reverse children update part
of the main loop.

The main loop already has a check for already visited nodes, so we don't
have to check this in advance -- we can simply push the node to the
worklist and skip it later.



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