diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:51:25 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-02 23:51:25 +0000 |
commit | bee0f663d842f5aa41286c22815446e2d22de95a (patch) | |
tree | d06882bfe7e3cdbdbdd391f9161e708f111e8dec /lib/Transforms/Scalar/LoopStrengthReduce.cpp | |
parent | 502db93a8ab376730164db43ca3ce8032b72bd59 (diff) | |
download | llvm-bee0f663d842f5aa41286c22815446e2d22de95a.tar.gz llvm-bee0f663d842f5aa41286c22815446e2d22de95a.tar.bz2 llvm-bee0f663d842f5aa41286c22815446e2d22de95a.tar.xz |
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
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index e97921237f..329da542d5 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -540,7 +540,7 @@ Value *BasedUser::InsertCodeForBaseAtPosition(const SCEVHandle &NewBase, // If there is no immediate value, skip the next part. if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Imm)) - if (SC->getValue()->isNullValue()) + if (SC->getValue()->isZero()) return Rewriter.expandCodeFor(NewBase, BaseInsertPt, OperandValToReplace->getType()); @@ -779,7 +779,7 @@ static void SeparateSubExprs(std::vector<SCEVHandle> &SubExprs, SeparateSubExprs(SubExprs, SARE->getOperand(0)); } } else if (!isa<SCEVConstant>(Expr) || - !cast<SCEVConstant>(Expr)->getValue()->isNullValue()) { + !cast<SCEVConstant>(Expr)->getValue()->isZero()) { // Do not add zero. SubExprs.push_back(Expr); } @@ -869,7 +869,7 @@ RemoveCommonExpressionsFromUseBases(std::vector<BasedUser> &Uses) { /// static bool isZero(SCEVHandle &V) { if (SCEVConstant *SC = dyn_cast<SCEVConstant>(V)) - return SC->getValue()->getZExtValue() == 0; + return SC->getValue()->isZero(); 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. // Add it to the expression used to rewrite the uses. if (!isa<ConstantInt>(CommonBaseV) || - !cast<ConstantInt>(CommonBaseV)->isNullValue()) + !cast<ConstantInt>(CommonBaseV)->isZero()) RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(CommonBaseV)); } // Now that we know what we need to do, insert code before User for the // 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. RewriteExpr = SCEVAddExpr::get(RewriteExpr, SCEVUnknown::get(BaseV)); |