[all-commits] [llvm/llvm-project] ec25a7: [ScheduleDAG] Avoid unnecessary recomputation of t...

Florian Hahn via All-commits all-commits at lists.llvm.org
Sun May 31 03:23:10 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ec25a71eb7fc72440149784951d62453301cc960
      https://github.com/llvm/llvm-project/commit/ec25a71eb7fc72440149784951d62453301cc960
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-05-31 (Sun, 31 May 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/ScheduleDAG.h
    M llvm/lib/CodeGen/ScheduleDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp

  Log Message:
  -----------
  [ScheduleDAG] Avoid unnecessary recomputation of topological order.

In some cases ScheduleDAGRRList has to add new nodes to resolve problems
with interfering physical registers. When new nodes are added, it
completely re-computes the topological order, which can take a long
time, but is unnecessary. We only add nodes one by one, and initially
they do not have any predecessors. So we can just insert them at the end
of the vector. Later we add predecessors, but the helper function
properly updates the topological order much more efficiently. With this
change, the compile time for the program below drops from 300s to 30s on
my machine.

    define i11129 @test1() {
      %L1 = load i11129, i11129* undef
      %B30 = ashr i11129 %L1, %L1
      store i11129 %B30, i11129* undef
      ret i11129 %L1
    }

This should be generally beneficial, as we can skip a large amount of
work. Theoretically there are some scenarios where we might not safe
much, e.g. when we add a dependency between the first and last node.
Then we would have to shift all nodes. But we still do not have to spend
the time re-computing the initial order.

Reviewers: MatzeB, atrick, efriedma, niravd, paquette

Reviewed By: paquette

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




More information about the All-commits mailing list