Skip to content

Commit ea99df2

Browse files
committed
[InstCombine] Rename some variables (NFC)
Split NFC rename out from #69882.
1 parent 22f1217 commit ea99df2

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7022,53 +7022,52 @@ Instruction *InstCombinerImpl::visitICmpInst(ICmpInst &I) {
70227022
return Res;
70237023

70247024
{
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
70287028
// 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),
70337033
Op1);
70347034

70357035
// ~X < ~Y --> Y < X
70367036
// ~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);
70407040

70417041
const APInt *C;
70427042
if (match(Op1, m_APInt(C)))
7043-
return new ICmpInst(I.getSwappedPredicate(), A,
7043+
return new ICmpInst(I.getSwappedPredicate(), X,
70447044
ConstantInt::get(Op1->getType(), ~(*C)));
70457045
}
70467046

70477047
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),
70497049
m_Instruction(AddI))) &&
7050-
isa<IntegerType>(A->getType())) {
7050+
isa<IntegerType>(X->getType())) {
70517051
Value *Result;
70527052
Constant *Overflow;
70537053
// m_UAddWithOverflow can match patterns that do not include an explicit
70547054
// "add" instruction, so check the opcode of the matched op.
70557055
if (AddI->getOpcode() == Instruction::Add &&
7056-
OptimizeOverflowCheck(Instruction::Add, /*Signed*/ false, A, B, *AddI,
7056+
OptimizeOverflowCheck(Instruction::Add, /*Signed*/ false, X, Y, *AddI,
70577057
Result, Overflow)) {
70587058
replaceInstUsesWith(*AddI, Result);
70597059
eraseInstFromFunction(*AddI);
70607060
return replaceInstUsesWith(I, Overflow);
70617061
}
70627062
}
70637063

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)))) &&
70667066
match(Op1, m_APInt(C))) {
70677067
if (Instruction *R = processUMulZExtIdiom(I, Op0, C, *this))
70687068
return R;
70697069
}
70707070

7071-
Value *X, *Y;
70727071
// Signbit test folds
70737072
// Fold (X u>> BitWidth - 1 Pred ZExt(i1)) --> X s< 0 Pred i1
70747073
// Fold (X s>> BitWidth - 1 Pred SExt(i1)) --> X s< 0 Pred i1

0 commit comments

Comments
 (0)