mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
DependenceAnalysis: Don't crash if there is no constant operand.
This makes the code match the comments. Resolves a crash in loop idiom (PR14219). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2278,11 +2278,12 @@ bool DependenceAnalysis::gcdMIVtest(const SCEV *Src,
|
||||
assert(!Constant && "Surprised to find multiple constants");
|
||||
Constant = cast<SCEVConstant>(Operand);
|
||||
}
|
||||
else if (isa<SCEVMulExpr>(Operand)) {
|
||||
else if (const SCEVMulExpr *Product = dyn_cast<SCEVMulExpr>(Operand)) {
|
||||
// Search for constant operand to participate in GCD;
|
||||
// If none found; return false.
|
||||
const SCEVConstant *ConstOp =
|
||||
getConstantPart(cast<SCEVMulExpr>(Operand));
|
||||
const SCEVConstant *ConstOp = getConstantPart(Product);
|
||||
if (!ConstOp)
|
||||
return false;
|
||||
APInt ConstOpValue = ConstOp->getValue()->getValue();
|
||||
ExtraGCD = APIntOps::GreatestCommonDivisor(ExtraGCD,
|
||||
ConstOpValue.abs());
|
||||
|
Reference in New Issue
Block a user