summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-18 16:54:33 +0000
committerDan Gohman <gohman@apple.com>2009-02-18 16:54:33 +0000
commitaa0f01929b4e68d92bde178e3ac8c505e2baac17 (patch)
tree1a8371396312e7cbf7db18fc5caefe38cdf98458 /llvm/lib/Transforms
parent7f1c0afc19110fb3b25cf0c0993fd5406ef6fd8a (diff)
downloadbcm5719-llvm-aa0f01929b4e68d92bde178e3ac8c505e2baac17.tar.gz
bcm5719-llvm-aa0f01929b4e68d92bde178e3ac8c505e2baac17.zip
Simplify by using dyn_cast instead of isa and cast.
llvm-svn: 64917
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index c496c57836f..e31b514b2fa 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -582,18 +582,17 @@ static const PHINode *TestOrigIVForWrap(const Loop *L,
// For now, only analyze loops with a constant start value, so that
// we can easily determine if the start value is not a maximum value
// which would wrap on the first iteration.
- const Value *InitialVal = PN->getIncomingValue(IncomingEdge);
- if (!isa<ConstantInt>(InitialVal))
+ const ConstantInt *InitialVal =
+ dyn_cast<ConstantInt>(PN->getIncomingValue(IncomingEdge));
+ if (!InitialVal)
return 0;
// The original induction variable will start at some non-max value,
// it counts up by one, and the loop iterates only while it remans
// less than some value in the same type. As such, it will never wrap.
- if (isSigned &&
- !cast<ConstantInt>(InitialVal)->getValue().isMaxSignedValue())
+ if (isSigned && !InitialVal->getValue().isMaxSignedValue())
NoSignedWrap = true;
- else if (!isSigned &&
- !cast<ConstantInt>(InitialVal)->getValue().isMaxValue())
+ else if (!isSigned && !InitialVal->getValue().isMaxValue())
NoUnsignedWrap = true;
return PN;
}
OpenPOWER on IntegriCloud