Reapply [InstCombine] Fold multiuse shr eq zero
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 19 Apr 2021 20:09:15 +0000 (22:09 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 22 May 2021 12:46:50 +0000 (14:46 +0200)
commit9a9421a461166482465e786a46f8cced63cd2e9f
treebbe8abe1c9fe8b9f4ae36e43fa5fc0f05e8197e4
parent211ce51f27e3b00806a6b3df830e0799b9ee8207
Reapply [InstCombine] Fold multiuse shr eq zero

This was reverted due to performance regressions in ARM benchmarks,
which have since been addressed by D101196 (SCEV analysis improvement)
and D101778 (CGP reverse transform).

-----

The single-use case is handled implicity by converting the icmp
into a mask check first. When comparing with zero in particular,
we don't need the one-use restriction, as we only produce a single
icmp.

https://alive2.llvm.org/ce/z/MSixcm
https://alive2.llvm.org/ce/z/GwpG0M
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/test/Transforms/InstCombine/icmp-shr.ll
llvm/test/Transforms/InstCombine/icmp_sdiv_with_and_without_range.ll
llvm/test/Transforms/PhaseOrdering/X86/ctlz-loop.ll