mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-03 17:24:24 +00:00
Make the range calculations for addrecs to be more conservative,
as they aren't currently prepared to handle complicated overflow cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c2b015e4c0
commit
a16b5764e3
@ -2619,10 +2619,15 @@ ScalarEvolution::getUnsignedRange(const SCEV *S) {
|
||||
MaxBECount = getNoopOrZeroExtend(MaxBECount, Ty);
|
||||
|
||||
const SCEV *Start = AddRec->getStart();
|
||||
const SCEV *Step = AddRec->getStepRecurrence(*this);
|
||||
const SCEV *End = AddRec->evaluateAtIteration(MaxBECount, *this);
|
||||
|
||||
// Check for overflow.
|
||||
if (!isKnownPredicate(ICmpInst::ICMP_ULE, Start, End))
|
||||
// TODO: This is very conservative.
|
||||
if (!(Step->isOne() &&
|
||||
isKnownPredicate(ICmpInst::ICMP_ULT, Start, End)) &&
|
||||
!(Step->isAllOnesValue() &&
|
||||
isKnownPredicate(ICmpInst::ICMP_UGT, Start, End)))
|
||||
return FullSet;
|
||||
|
||||
ConstantRange StartRange = getUnsignedRange(Start);
|
||||
@ -2728,9 +2733,10 @@ ScalarEvolution::getSignedRange(const SCEV *S) {
|
||||
const SCEV *End = AddRec->evaluateAtIteration(MaxBECount, *this);
|
||||
|
||||
// Check for overflow.
|
||||
if (!(isKnownPositive(Step) &&
|
||||
// TODO: This is very conservative.
|
||||
if (!(Step->isOne() &&
|
||||
isKnownPredicate(ICmpInst::ICMP_SLT, Start, End)) &&
|
||||
!(isKnownNegative(Step) &&
|
||||
!(Step->isAllOnesValue() &&
|
||||
isKnownPredicate(ICmpInst::ICMP_SGT, Start, End)))
|
||||
return FullSet;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user