mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-13 10:32:06 +00:00
Finally get this patch right :)
Replace expensive getZExtValue() == 0 calls with isZero() calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34861 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
502db93a8a
commit
bee0f663d8
@ -540,7 +540,7 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase,
|
|||||||
|
|
||||||
// If there is no immediate value, skip the next part.
|
// If there is no immediate value, skip the next part.
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm))
|
||||||
if (SC->getValue()->isNullValue())
|
if (SC->getValue()->isZero())
|
||||||
return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
|
return Rewriter.expandCodeFor(NewBase, BaseInsertPt,
|
||||||
OperandValToReplace->getType());
|
OperandValToReplace->getType());
|
||||||
|
|
||||||
@ -779,7 +779,7 @@ static void SeparateSubExprs(std::vector<SCEVHandle> &SubExprs,
|
|||||||
SeparateSubExprs(SubExprs, SARE->getOperand(0));
|
SeparateSubExprs(SubExprs, SARE->getOperand(0));
|
||||||
}
|
}
|
||||||
} else if (!isa<SCEVConstant>(Expr) ||
|
} else if (!isa<SCEVConstant>(Expr) ||
|
||||||
!cast<SCEVConstant>(Expr)->getValue()->isNullValue()) {
|
!cast<SCEVConstant>(Expr)->getValue()->isZero()) {
|
||||||
// Do not add zero.
|
// Do not add zero.
|
||||||
SubExprs.push_back(Expr);
|
SubExprs.push_back(Expr);
|
||||||
}
|
}
|
||||||
@ -869,7 +869,7 @@ RemoveCommonExpressionsFromUseBases(std::vector<BasedUser> &Uses) {
|
|||||||
///
|
///
|
||||||
static bool isZero(SCEVHandle &V) {
|
static bool isZero(SCEVHandle &V) {
|
||||||
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
|
if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V))
|
||||||
return SC->getValue()->getZExtValue() == 0;
|
return SC->getValue()->isZero();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1148,14 +1148,14 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
|
|||||||
// are reusing an IV, it has not been used to initialize the PHI node.
|
// are reusing an IV, it has not been used to initialize the PHI node.
|
||||||
// Add it to the expression used to rewrite the uses.
|
// Add it to the expression used to rewrite the uses.
|
||||||
if (!isa<ConstantInt>(CommonBaseV) ||
|
if (!isa<ConstantInt>(CommonBaseV) ||
|
||||||
!cast<ConstantInt>(CommonBaseV)->isNullValue())
|
!cast<ConstantInt>(CommonBaseV)->isZero())
|
||||||
RewriteExpr = SCEVAddExpr::get(RewriteExpr,
|
RewriteExpr = SCEVAddExpr::get(RewriteExpr,
|
||||||
SCEVUnknown::get(CommonBaseV));
|
SCEVUnknown::get(CommonBaseV));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we know what we need to do, insert code before User for the
|
// Now that we know what we need to do, insert code before User for the
|
||||||
// immediate and any loop-variant expressions.
|
// immediate and any loop-variant expressions.
|
||||||
if (!isa<ConstantInt>(BaseV) || !cast<ConstantInt>(BaseV)->isNullValue())
|
if (!isa<ConstantInt>(BaseV) || !cast<ConstantInt>(BaseV)->isZero())
|
||||||
// Add BaseV to the PHI value if needed.
|
// Add BaseV to the PHI value if needed.
|
||||||
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
|
RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user