[all-commits] [llvm/llvm-project] 193c1f: Reapply "[TableGen] Reduce number of call to Facto...

Craig Topper via All-commits all-commits at lists.llvm.org
Sun Feb 15 19:16:01 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 193c1f4af7f1bd9249c99bc3c0b7d9ebe4698d11
      https://github.com/llvm/llvm-project/commit/193c1f4af7f1bd9249c99bc3c0b7d9ebe4698d11
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2026-02-15 (Sun, 15 Feb 2026)

  Changed paths:
    M llvm/utils/TableGen/DAGISelMatcher.h
    M llvm/utils/TableGen/DAGISelMatcherOpt.cpp

  Log Message:
  -----------
  Reapply "[TableGen] Reduce number of call to FactorNodes. NFC"

With a fix to avoid deferencing a before_begin iterator.

Original commit message:

Previously we recursively called FactorNodes all the way down the
tree any time FactorNodes was called. Additionally, on returning
from the recursiion we would flatten any child ScopeMatchers into
the parent.

There are additional calls to FactorNodes every time a new ScopeMatcher
is created. These calls cause a lot of visiting of parts of the tree that
have already been factored as much as possible.

We can remove the primary recursion by ensuring we flatten
scopes when building a new ScopeMatcher. If the Matcher we are
going to insert into the new ScopeMatcher is itself a ScopeMatcher,
we add the children into the new ScopeMatcher instead. This makes
the FactorNodes call for the newly created scope more powerful
eliminating the need for the recursion



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