[PATCH] D105363: [InstCombine] Transitively propagate `unreachable` into predecessors

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 2 11:39:26 PDT 2021


lebedev.ri created this revision.
lebedev.ri added reviewers: spatel, nikic, jdoerfert.
lebedev.ri added a project: LLVM.
Herald added a subscriber: hiraditya.
lebedev.ri requested review of this revision.

Currently we try to erase instructions only in the very block
that literally has `unreachable` terminator.
While this is conservatively correct, we can do better.

If the block consists only of said `unreachable`,
then it stops being a successor of it's predecessors,
and if for some predecessor that means it no longer has
any successors, then said predecessor earns an `unreachable`
terminator itself. And so on.

SimplifyCFG would do at least some of that,
but relying on that requires for the InstCombine pass
to be rerun after SimplifyCFG, which isn't optimal..


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105363

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/assume.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105363.356234.patch
Type: text/x-patch
Size: 9717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210702/f222d5fd/attachment.bin>


More information about the llvm-commits mailing list