@@ -7022,53 +7022,52 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
7022
7022
return Res;
7023
7023
7024
7024
{
7025
- Value *A , *B ;
7026
- // Transform (A & ~B ) == 0 --> (A & B ) != 0
7027
- // and (A & ~B ) != 0 --> (A & B ) == 0
7025
+ Value *X , *Y ;
7026
+ // Transform (X & ~Y ) == 0 --> (X & Y ) != 0
7027
+ // and (X & ~Y ) != 0 --> (X & Y ) == 0
7028
7028
// if A is a power of 2.
7029
- if (match (Op0, m_And (m_Value (A ), m_Not (m_Value (B )))) &&
7030
- match (Op1, m_Zero ()) &&
7031
- isKnownToBeAPowerOfTwo (A, false , 0 , &I) && I.isEquality ())
7032
- return new ICmpInst (I.getInversePredicate (), Builder.CreateAnd (A, B ),
7029
+ if (match (Op0, m_And (m_Value (X ), m_Not (m_Value (Y )))) &&
7030
+ match (Op1, m_Zero ()) && isKnownToBeAPowerOfTwo (X, false , 0 , &I) &&
7031
+ I.isEquality ())
7032
+ return new ICmpInst (I.getInversePredicate (), Builder.CreateAnd (X, Y ),
7033
7033
Op1);
7034
7034
7035
7035
// ~X < ~Y --> Y < X
7036
7036
// ~X < C --> X > ~C
7037
- if (match (Op0, m_Not (m_Value (A )))) {
7038
- if (match (Op1, m_Not (m_Value (B ))))
7039
- return new ICmpInst (I.getPredicate (), B, A );
7037
+ if (match (Op0, m_Not (m_Value (X )))) {
7038
+ if (match (Op1, m_Not (m_Value (Y ))))
7039
+ return new ICmpInst (I.getPredicate (), Y, X );
7040
7040
7041
7041
const APInt *C;
7042
7042
if (match (Op1, m_APInt (C)))
7043
- return new ICmpInst (I.getSwappedPredicate (), A ,
7043
+ return new ICmpInst (I.getSwappedPredicate (), X ,
7044
7044
ConstantInt::get (Op1->getType (), ~(*C)));
7045
7045
}
7046
7046
7047
7047
Instruction *AddI = nullptr ;
7048
- if (match (&I, m_UAddWithOverflow (m_Value (A ), m_Value (B ),
7048
+ if (match (&I, m_UAddWithOverflow (m_Value (X ), m_Value (Y ),
7049
7049
m_Instruction (AddI))) &&
7050
- isa<IntegerType>(A ->getType ())) {
7050
+ isa<IntegerType>(X ->getType ())) {
7051
7051
Value *Result;
7052
7052
Constant *Overflow;
7053
7053
// m_UAddWithOverflow can match patterns that do not include an explicit
7054
7054
// "add" instruction, so check the opcode of the matched op.
7055
7055
if (AddI->getOpcode () == Instruction::Add &&
7056
- OptimizeOverflowCheck (Instruction::Add, /* Signed*/ false , A, B , *AddI,
7056
+ OptimizeOverflowCheck (Instruction::Add, /* Signed*/ false , X, Y , *AddI,
7057
7057
Result, Overflow)) {
7058
7058
replaceInstUsesWith (*AddI, Result);
7059
7059
eraseInstFromFunction (*AddI);
7060
7060
return replaceInstUsesWith (I, Overflow);
7061
7061
}
7062
7062
}
7063
7063
7064
- // (zext a ) * (zext b ) --> llvm.umul.with.overflow.
7065
- if (match (Op0, m_NUWMul (m_ZExt (m_Value (A )), m_ZExt (m_Value (B )))) &&
7064
+ // (zext X ) * (zext Y ) --> llvm.umul.with.overflow.
7065
+ if (match (Op0, m_NUWMul (m_ZExt (m_Value (X )), m_ZExt (m_Value (Y )))) &&
7066
7066
match (Op1, m_APInt (C))) {
7067
7067
if (Instruction *R = processUMulZExtIdiom (I, Op0, C, *this ))
7068
7068
return R;
7069
7069
}
7070
7070
7071
- Value *X, *Y;
7072
7071
// Signbit test folds
7073
7072
// Fold (X u>> BitWidth - 1 Pred ZExt(i1)) --> X s< 0 Pred i1
7074
7073
// Fold (X s>> BitWidth - 1 Pred SExt(i1)) --> X s< 0 Pred i1
0 commit comments