[PATCH] D109917: [InstCombine] Improve TryToSink for side-effecting calls that would be trivially dead

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 16 13:19:35 PDT 2021


anna created this revision.
anna added reviewers: reames, nikic, mkazantsev, apilipenko.
Herald added a subscriber: hiraditya.
anna requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch adds support to sink side-effecting calls that are legal to
sink to the successor use block. We can sink such calls as long as these
two conditions are satisfied:

1. The instruction would be trivially dead (i.e. if there were no uses of the instruction, we can remove the instruction).
2. There are no side-effecting instructions between the current one until the end of the block.

This helps with sinking allocations down to use blocks when safe to do
so (see added testcases).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109917

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109917.373051.patch
Type: text/x-patch
Size: 7904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210916/f92a56d6/attachment.bin>


More information about the llvm-commits mailing list