forked from OSchip/llvm-project
Simplify by using dyn_cast instead of isa and cast.
llvm-svn: 64917
This commit is contained in:
parent
7f1c0afc19
commit
aa0f01929b
|
@ -582,18 +582,17 @@ static const PHINode *TestOrigIVForWrap(const Loop *L,
|
||||||
// For now, only analyze loops with a constant start value, so that
|
// 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
|
// we can easily determine if the start value is not a maximum value
|
||||||
// which would wrap on the first iteration.
|
// which would wrap on the first iteration.
|
||||||
const Value *InitialVal = PN->getIncomingValue(IncomingEdge);
|
const ConstantInt *InitialVal =
|
||||||
if (!isa<ConstantInt>(InitialVal))
|
dyn_cast<ConstantInt>(PN->getIncomingValue(IncomingEdge));
|
||||||
|
if (!InitialVal)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// The original induction variable will start at some non-max value,
|
// The original induction variable will start at some non-max value,
|
||||||
// it counts up by one, and the loop iterates only while it remans
|
// 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.
|
// less than some value in the same type. As such, it will never wrap.
|
||||||
if (isSigned &&
|
if (isSigned && !InitialVal->getValue().isMaxSignedValue())
|
||||||
!cast<ConstantInt>(InitialVal)->getValue().isMaxSignedValue())
|
|
||||||
NoSignedWrap = true;
|
NoSignedWrap = true;
|
||||||
else if (!isSigned &&
|
else if (!isSigned && !InitialVal->getValue().isMaxValue())
|
||||||
!cast<ConstantInt>(InitialVal)->getValue().isMaxValue())
|
|
||||||
NoUnsignedWrap = true;
|
NoUnsignedWrap = true;
|
||||||
return PN;
|
return PN;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue