mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
Teach ScalarEvolution how to fold trunc(undef) and anyext(undef) to undef.
This helps LSR behave more consistently on bugpoint-reduced testcases. llvm-svn: 108451
This commit is contained in:
parent
f5525353b4
commit
04768aa9a5
@ -845,6 +845,13 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCEV *Op,
|
||||
return getAddRecExpr(Operands, AddRec->getLoop());
|
||||
}
|
||||
|
||||
// As a special case, fold trunc(undef) to undef. We don't want to
|
||||
// know too much about SCEVUnknowns, but this special case is handy
|
||||
// and harmless.
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Op))
|
||||
if (isa<UndefValue>(U->getValue()))
|
||||
return getSCEV(UndefValue::get(Ty));
|
||||
|
||||
// The cast wasn't folded; create an explicit cast node. We can reuse
|
||||
// the existing insert position since if we get here, we won't have
|
||||
// made any changes which would invalidate it.
|
||||
@ -1163,6 +1170,13 @@ const SCEV *ScalarEvolution::getAnyExtendExpr(const SCEV *Op,
|
||||
return getAddRecExpr(Ops, AR->getLoop());
|
||||
}
|
||||
|
||||
// As a special case, fold anyext(undef) to undef. We don't want to
|
||||
// know too much about SCEVUnknowns, but this special case is handy
|
||||
// and harmless.
|
||||
if (const SCEVUnknown *U = dyn_cast<SCEVUnknown>(Op))
|
||||
if (isa<UndefValue>(U->getValue()))
|
||||
return getSCEV(UndefValue::get(Ty));
|
||||
|
||||
// If the expression is obviously signed, use the sext cast value.
|
||||
if (isa<SCEVSMaxExpr>(Op))
|
||||
return SExt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user