[InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1
authorZhongyunde <zhongyunde@huawei.com>
Wed, 26 Apr 2023 07:52:28 +0000 (15:52 +0800)
committerZhongyunde <zhongyunde@huawei.com>
Wed, 26 Apr 2023 07:53:02 +0000 (15:53 +0800)
commitf9478f729e68af4d32f20a93382f94744141d4a3
treee31e4c0f11c048f68c6963561961a6acad6dbc2a
parent0f28cecf1bb7e26775aedecd0300e909222ab204
[InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1

Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-and,
then both of ICMP_NE and ICMP_EQ will be addressed including vector type.
    (X & Y) == -1 ?  X : -1 --> -1 (commuted 2 ways)
    (X & Y) != -1 ? -1 :  X --> -1 (commuted 2 ways)
This is a supplement to the icmp-or scenario on D148986.

Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149229
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstSimplify/select_or_and.ll