mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 17:29:19 +00:00
Negating a recurrence preserves no-self-wrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127593 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0c4d44aa7a
commit
a053b21177
@ -1792,6 +1792,17 @@ const SCEV *ScalarEvolution::getMulExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
if (AnyFolded)
|
||||
return getAddExpr(NewOps);
|
||||
}
|
||||
else if (const SCEVAddRecExpr *
|
||||
AddRec = dyn_cast<SCEVAddRecExpr>(Ops[1])) {
|
||||
// Negation preserves a recurrence's no self-wrap property.
|
||||
SmallVector<const SCEV *, 4> Operands;
|
||||
for (SCEVAddRecExpr::op_iterator I = AddRec->op_begin(),
|
||||
E = AddRec->op_end(); I != E; ++I) {
|
||||
Operands.push_back(getMulExpr(Ops[0], *I));
|
||||
}
|
||||
return getAddRecExpr(Operands, AddRec->getLoop(),
|
||||
AddRec->getNoWrapFlags(SCEV::FlagNW));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user