mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-30 17:25:21 +00:00
Simplify code. No functionality changes, name changes aside.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132896 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1087,19 +1087,14 @@ Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI,
|
||||
// have its sign bit set or if it is an equality comparison.
|
||||
// Extending a relational comparison when we're checking the sign
|
||||
// bit would not work.
|
||||
if (Cast->hasOneUse() &&
|
||||
(ICI.isEquality() ||
|
||||
(AndCST->getValue().isNonNegative() && RHSV.isNonNegative()))) {
|
||||
uint32_t BitWidth =
|
||||
cast<IntegerType>(Cast->getOperand(0)->getType())->getBitWidth();
|
||||
APInt NewCST = AndCST->getValue().zext(BitWidth);
|
||||
APInt NewCI = RHSV.zext(BitWidth);
|
||||
Value *NewAnd =
|
||||
if (ICI.isEquality() ||
|
||||
(AndCST->getValue().isNonNegative() && RHSV.isNonNegative())) {
|
||||
Value *NewAnd =
|
||||
Builder->CreateAnd(Cast->getOperand(0),
|
||||
ConstantInt::get(ICI.getContext(), NewCST),
|
||||
LHSI->getName());
|
||||
ConstantExpr::getZExt(AndCST, Cast->getSrcTy()));
|
||||
NewAnd->takeName(LHSI);
|
||||
return new ICmpInst(ICI.getPredicate(), NewAnd,
|
||||
ConstantInt::get(ICI.getContext(), NewCI));
|
||||
ConstantExpr::getZExt(RHS, Cast->getSrcTy()));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user