[InstCombine] Handle undef when pruning unreachable code
authorNikita Popov <npopov@redhat.com>
Thu, 25 May 2023 14:52:16 +0000 (16:52 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 26 May 2023 13:55:28 +0000 (15:55 +0200)
commit1fc425380e9860a6beb53fa68d02e7fb14969963
tree04055b7c2ff374b0f94b466dd0db0dcb2cb26c30
parent8f12057e8ec638add17c1ac0019cafbbf4a3ed3b
[InstCombine] Handle undef when pruning unreachable code

If the branch condition is undef, then behavior is undefined and
neither of the successors are live.

This is to ensure that optimization quality does not decrease
when a constant gets replaced with undef/poison in this context.
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/unreachable-code.ll