[InstCombine] fold mask with not-of-sext-bool to select
authorSanjay Patel <spatel@rotateright.com>
Mon, 2 Jan 2023 18:31:01 +0000 (13:31 -0500)
committerSanjay Patel <spatel@rotateright.com>
Mon, 2 Jan 2023 18:33:28 +0000 (13:33 -0500)
commitcb9569049c24e513afe215d5ac3b3dbc79dacf43
treec78547c9255bfd0fda7e3fff0adc437f1a22d56f
parent871c415f2d8a25851929922bf6a82ba0a660a69f
[InstCombine] fold mask with not-of-sext-bool to select

~sext(A) & Op1 --> A ? 0 : Op1

With no extra uses, this pattern is already reduced,
but we would miss it in examples such as issue #59773.

https://alive2.llvm.org/ce/z/WGLcSR
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/binop-cast.ll