[InstCombine] Handle const select arm in foldSelectCtlzToCttz()
authorNikita Popov <npopov@redhat.com>
Fri, 14 Jul 2023 09:59:22 +0000 (11:59 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 14 Jul 2023 10:00:39 +0000 (12:00 +0200)
commitcd1dcd2c956188521e668e77eec1f8913c01b644
tree161e9a5a2344ee8d5f7f425949a709fb1303885a
parent701a8b348ecd74d991c979343a51171a11d5e3ee
[InstCombine] Handle const select arm in foldSelectCtlzToCttz()

The select arm that takes the ctlz result can also instead be a
constant with the bit width (as this is what the ctlz evaluates to
for a==0).

This avoids a regression when strengthening the
simplifyWithOpReplaced() fold.

Proof: https://alive2.llvm.org/ce/z/DMRL5A
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-ctlz-to-cttz.ll