[instcombine] Allow sinking of calls with known writes to uses
authorPhilip Reames <listmail@philipreames.com>
Wed, 5 Jan 2022 16:53:33 +0000 (08:53 -0800)
committerPhilip Reames <listmail@philipreames.com>
Wed, 5 Jan 2022 18:37:22 +0000 (10:37 -0800)
commit58a0e449e175e9ae48632b4bda1df1fc87f81323
tree73dc7dd6cfad21c1e0c56c2c8c2d907457a8a1fb
parentdd48c6aff99233ff46ab08009e26baf3b2ed6f14
[instcombine] Allow sinking of calls with known writes to uses

If we have a call whose only side effect is a write to a location which is known to be dead, we can sink said call to the users of the call's result value. This is analogous to the recent changes to delete said calls if unused, but framed as a sinking transform instead.

Differential Revision: https://reviews.llvm.org/D116200
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/sink_sideeffecting_instruction.ll