diff options
author | Dan Gohman <gohman@apple.com> | 2009-02-18 16:54:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-02-18 16:54:33 +0000 |
commit | cad24c9abc834db5cf8f92019f99370507d8d07a (patch) | |
tree | d6052d7498d2edb932dfd18a5b491bfe50918a17 /lib/Transforms | |
parent | b317143ba851ce2853fb262fb2185ef5f1be030d (diff) | |
download | external_llvm-cad24c9abc834db5cf8f92019f99370507d8d07a.zip external_llvm-cad24c9abc834db5cf8f92019f99370507d8d07a.tar.gz external_llvm-cad24c9abc834db5cf8f92019f99370507d8d07a.tar.bz2 |
Simplify by using dyn_cast instead of isa and cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index c496c57..e31b514 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/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; } |