[InstCombine] Sink instructions with multiple users in a successor block.
authorAndrew Wei <weiwei64@huawei.com>
Fri, 18 Mar 2022 03:49:59 +0000 (11:49 +0800)
committerAndrew Wei <weiwei64@huawei.com>
Fri, 18 Mar 2022 03:53:45 +0000 (11:53 +0800)
commit0af3e6a22da2eda5021b5fad656d0b9db7702e0a
tree9021746b7e2ebfd23a8ff748bd48476beda375b6
parentc236b41e451a4b25767ff16fcd025b05a4a8e0c4
[InstCombine] Sink instructions with multiple users in a successor block.

This patch tries to sink instructions when they are only used in a successor block.

This is a further enhancement patch based on Anna's commit:
D109700, which allows sinking an instruction having multiple uses in a single user.

In this patch, sink instructions with multiple users in a single successor block will be supported.
It could fix a known issue from rust:
  https://github.com/rust-lang/rust/issues/51346#issuecomment-394443610

Reviewed By: nikic, reames

Differential Revision: https://reviews.llvm.org/D121585
17 files changed:
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/intptr7.ll
llvm/test/Transforms/InstCombine/lifetime-no-null-opt.ll
llvm/test/Transforms/InstCombine/lifetime.ll
llvm/test/Transforms/InstCombine/merging-multiple-stores-into-successor.ll
llvm/test/Transforms/InstCombine/pr33689_same_bitwidth.ll
llvm/test/Transforms/InstCombine/shift-by-signext.ll
llvm/test/Transforms/InstCombine/sink_instruction.ll
llvm/test/Transforms/LoopUnroll/runtime-unroll-remainder.ll
llvm/test/Transforms/LoopVectorize/X86/invariant-load-gather.ll
llvm/test/Transforms/LoopVectorize/X86/small-size.ll
llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-store-accesses-with-gaps.ll
llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll
llvm/test/Transforms/LoopVectorize/induction.ll
llvm/test/Transforms/LoopVectorize/interleaved-accesses.ll
llvm/test/Transforms/LowerMatrixIntrinsics/multiply-fused-dominance.ll
llvm/test/Transforms/PGOProfile/chr.ll