mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-24 08:33:39 +00:00
Fix for PR9633 [indvars] Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Added a type check in ScalarEvolution::computeSCEVAtScope to handle the case in which operands of an AddRecExpr in the current scope are folded. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130271 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
cb5fd743a9
commit
3f95c88162
@ -4701,9 +4701,14 @@ const SCEV *ScalarEvolution::computeSCEVAtScope(const SCEV *V, const Loop *L) {
|
||||
for (++i; i != e; ++i)
|
||||
NewOps.push_back(getSCEVAtScope(AddRec->getOperand(i), L));
|
||||
|
||||
AddRec = cast<SCEVAddRecExpr>(
|
||||
const SCEV *FoldedRec =
|
||||
getAddRecExpr(NewOps, AddRec->getLoop(),
|
||||
AddRec->getNoWrapFlags(SCEV::FlagNW)));
|
||||
AddRec->getNoWrapFlags(SCEV::FlagNW));
|
||||
AddRec = dyn_cast<SCEVAddRecExpr>(FoldedRec);
|
||||
// In cases with "undef" values, a loop's own recurrence may
|
||||
// fold into a constant. Go ahead and return the optimistic value.
|
||||
if (!AddRec)
|
||||
return FoldedRec;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user