[PATCH] D80120: [InstCombine] Sink pure instructions down to return and unreachable blocks

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 18 06:25:05 PDT 2020


mkazantsev created this revision.
mkazantsev added reviewers: lebedev.ri, fhahn, spatel, asbirlea.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

If the only user of `Instr` is in a return or unreachable block, we can
sink `Instr` to the`User` safely (unless it reads/writes memory).
Return or unreachable blocks are guaranteed to execute zero
or one time, and `Instr` always dominates `User`, so they either will
be executed together (execution of `User` always implies execution
of `Instr`) or not executed at all.


https://reviews.llvm.org/D80120

Files:
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/test/Transforms/InstCombine/insert-extract-shuffle.ll
  llvm/test/Transforms/InstCombine/overflow.ll
  llvm/test/Transforms/InstCombine/sink_to_unreachable.ll
  llvm/test/Transforms/PGOProfile/chr.ll
  llvm/test/Transforms/SimplifyCFG/merge-cond-stores.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80120.264601.patch
Type: text/x-patch
Size: 12181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/b62285a0/attachment.bin>


More information about the llvm-commits mailing list