[InstCombine] (rot X, ?) == 0/-1 --> X == 0/-1
authorChenbing Zheng <Chenbing.Zheng@streamcomputing.com>
Thu, 19 May 2022 03:22:26 +0000 (11:22 +0800)
committerChenbing Zheng <Chenbing.Zheng@streamcomputing.com>
Thu, 19 May 2022 03:22:26 +0000 (11:22 +0800)
commitffaaf2498bda550beeedadb79060323b8d3b0188
tree7eb9c35231343df2fe18f3ac00b2c9def7e3ed9b
parent51df77f36d8e769c17a4c3adab394911a770217e
[InstCombine] (rot X, ?) == 0/-1 --> X == 0/-1

In this patch we add a function foldICmpInstWithConstantAllowUndef
to fold integer comparisons with a constant operand: icmp Pred X, C
where X is some kind of instruction and C is AllowUndef.

We move this fold to the new function, so that it can solve undef elts in a vector.

Reviewed By: spatel, RKSimon

Differential Revision: https://reviews.llvm.org/D125220
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/test/Transforms/InstCombine/icmp-fsh.ll