1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times in

"make check" alone.

llvm-svn: 124046
This commit is contained in:
Nick Lewycky 2011-01-22 22:06:21 +00:00
parent ee9652eceb
commit 4440e5815b

View File

@ -1035,6 +1035,10 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
void *IP = 0;
if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
// If the input value is provably positive, build a zext instead.
if (isKnownNonNegative(Op))
return getZeroExtendExpr(Op, Ty);
// If the input value is a chrec scev, and we can prove that the value
// did not overflow the old, smaller, value, we can sign extend all of the
// operands (often constants). This allows analysis of something like