[all-commits] [llvm/llvm-project] f1b05a: [StructurizeCFG] Improve basic block ordering

bcahoon via All-commits all-commits at lists.llvm.org
Wed Jun 22 14:13:37 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f1b05a0a2bbbea160002be709f8a1c59de366761
      https://github.com/llvm/llvm-project/commit/f1b05a0a2bbbea160002be709f8a1c59de366761
  Author: Brendon Cahoon <brendon.cahoon at amd.com>
  Date:   2022-06-22 (Wed, 22 Jun 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
    M llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
    A llvm/test/Transforms/StructurizeCFG/improve-order.ll

  Log Message:
  -----------
  [StructurizeCFG] Improve basic block ordering

StructurizeCFG linearizes the successors of branching basic block
by adding Flow blocks to record the true/false path for branches
and back edges. This patch reduces the number of Phi values needed
to capture the control flow path by improving the basic block
ordering.

Previously, StructurizeCFG adds loop exit blocks outside of the
loop. StructurizeCFG sets a boolean value to indicate the path
taken, and all exit block live values extend to after the loop.
For loops with a large number of exits blocks, this creates a
huge number of values that are maintained, which increases
compilation time and register pressure. This is problem
especially with ASAN, which adds early exits to blocks with
unreachable instructions for each instrumented check in the loop.

In specific cases, this patch reduces the number of values needed
after the loop by moving the exit block into the loop. This is
done for blocks that have a single predecessor and single successor
by moving the block to appear just after the predecessor.

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




More information about the All-commits mailing list