[all-commits] [llvm/llvm-project] bc405e: llvm-reduce: Don't turn switches into returns

Matt Arsenault via All-commits all-commits at lists.llvm.org
Fri Oct 28 17:07:40 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bc405e37ee96092b2b6a0968e777a17da6c9000a
      https://github.com/llvm/llvm-project/commit/bc405e37ee96092b2b6a0968e777a17da6c9000a
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-10-28 (Fri, 28 Oct 2022)

  Changed paths:
    A llvm/test/tools/llvm-reduce/remove-bb-switch-default.ll
    M llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp

  Log Message:
  -----------
  llvm-reduce: Don't turn switches into returns

Re-use one of the existing successors as the new default.
This helps with a future patch to fix handling of unreachable
blocks.


  Commit: 45a91c1521b243b728d4ce69f8d19a449627d251
      https://github.com/llvm/llvm-project/commit/45a91c1521b243b728d4ce69f8d19a449627d251
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-10-28 (Fri, 28 Oct 2022)

  Changed paths:
    A llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error0.ll
    A llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error1.ll
    A llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error2.ll
    A llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error3.ll
    A llvm/test/tools/llvm-reduce/reduce-blocks-only-phi-nodes-may-reference-own-value.ll
    M llvm/test/tools/llvm-reduce/remove-bb-switch-default.ll
    M llvm/test/tools/llvm-reduce/remove-bbs-unreachable.ll
    M llvm/tools/llvm-reduce/DeltaManager.cpp
    M llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp
    M llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.h

  Log Message:
  -----------
  llvm-reduce: Fix block reduction with unreachable blocks

Previously this would produce many invalid reductions with
"Instruction does not dominate uses" verifier errors.

This fixes issues in cases where the incoming IR
has unreachable blocks, and the resulting reduction
introduced new reachable blocks.

Have basic-blocks skip functions that have unreachable
blocks, Introduce a separate reduction which only
deletes unreachable blocks. Cleanup any newly unreachable
blocks after trimming out the requested deletions.

Includes a variety of meta-reduced tests for llvm-reduce
itself with -abort-on-invalid-reduction that were failing
on different iterations of this patch.

Bugpoint's implementation is much simpler (but currently I don't
understand how it avoids disconnecting interesting blocks from the CFG).


  Commit: f02bc70c7d53e5898abddc83f249ef28b8b4b9b6
      https://github.com/llvm/llvm-project/commit/f02bc70c7d53e5898abddc83f249ef28b8b4b9b6
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-10-28 (Fri, 28 Oct 2022)

  Changed paths:
    A llvm/test/tools/llvm-reduce/reduce-bb-merge-next-block-invalid-reduction.ll
    M llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error1.ll
    M llvm/test/tools/llvm-reduce/reduce-bb-unreachable-does-not-dominate-error3.ll
    M llvm/test/tools/llvm-reduce/remove-bbs-sequence.ll
    M llvm/test/tools/llvm-reduce/remove-bbs-unwinded-to.ll
    M llvm/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp

  Log Message:
  -----------
  llvm-reduce: Fix producing invalid reductions with landingpads

It's not valid to simply branch to a landingpad block, so it
needs to be removed.

Also stop trying to scan forward to find a block that can be merged.
The predecessor merge rules are more complex than this. This also
would need to have considered landingpads. Just do the minimum
to delete the block, and let the simplify-cfg reduction handle
the branch chain cleanups.


Compare: https://github.com/llvm/llvm-project/compare/fd35e1506011...f02bc70c7d53


More information about the All-commits mailing list