mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
SCEV: Handle a corner case reducing AddRecExpr * AddRecExpr
If integer overflow causes one of the terms to reach zero, that can force the entire expression to zero. Fixes PR12929: cast<Ty>() argument of incompatible type git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157673 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2088,9 +2088,12 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
const SCEV *NewAddRec = getAddRecExpr(AddRecOps, AddRec->getLoop(),
|
||||
SCEV::FlagAnyWrap);
|
||||
if (Ops.size() == 2) return NewAddRec;
|
||||
Ops[Idx] = AddRec = cast<SCEVAddRecExpr>(NewAddRec);
|
||||
Ops[Idx] = NewAddRec;
|
||||
Ops.erase(Ops.begin() + OtherIdx); --OtherIdx;
|
||||
OpsModified = true;
|
||||
AddRec = dyn_cast<SCEVAddRecExpr>(NewAddRec);
|
||||
if (!AddRec)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (OpsModified)
|
||||
|
||||
Reference in New Issue
Block a user