[PATCH] D136461: llvm-reduce: Fix block reduction with unreachable blocks

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 09:03:43 PDT 2022


arsenm created this revision.
arsenm added reviewers: regehr, aeubanks, lebedev.ri.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

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).


https://reviews.llvm.org/D136461

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136461.469641.patch
Type: text/x-patch
Size: 22014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221021/d4c39fc7/attachment.bin>


More information about the llvm-commits mailing list