[InstCombine] Instruction sinking: fix check for function terminating block
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 20 Jan 2022 19:41:31 +0000 (22:41 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 20 Jan 2022 19:41:31 +0000 (22:41 +0300)
commitba8eb31bd9542828f6424e15a3014f80f14522c8
tree5cf624dcf2f722ca54fdeb72d19df003857b0a11
parent63a991d0358970d76700d084f05eb95cd29234c0
[InstCombine] Instruction sinking: fix check for function terminating block

Checking for specific function terminating opcodes
means we don't handle other non-hardcoded ones :)

This should probably be generalized to something
similar to the `IsBlockFollowedByDeoptOrUnreachable()`.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D117810
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/sink-into-resume-block.ll