mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-25 16:29:20 +00:00
one more instcombine variant that is needed to work with future changes,
no functionality change currently. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123517 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
27a98482bd
commit
67920320b2
@ -672,6 +672,15 @@ Instruction *InstCombiner::visitSub(BinaryOperator &I) {
|
|||||||
Value *NewMul = Builder->CreateMul(A, B);
|
Value *NewMul = Builder->CreateMul(A, B);
|
||||||
return BinaryOperator::CreateAdd(Op0, NewMul);
|
return BinaryOperator::CreateAdd(Op0, NewMul);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X - A*Cst -> X + A*-Cst
|
||||||
|
// X - Cst*A -> X + A*-Cst
|
||||||
|
ConstantInt *BCst;
|
||||||
|
if (match(Op1I, m_Mul(m_Value(A), m_ConstantInt(BCst))) ||
|
||||||
|
match(Op1I, m_Mul(m_ConstantInt(BCst), m_Value(A)))) {
|
||||||
|
Value *NewMul = Builder->CreateMul(A, ConstantExpr::getNeg(BCst));
|
||||||
|
return BinaryOperator::CreateAdd(Op0, NewMul);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user