[llvm-commits] [llvm] r124046 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Nick Lewycky
nicholas at mxc.ca
Sat Jan 22 14:06:21 PST 2011
Author: nicholas
Date: Sat Jan 22 16:06:21 2011
New Revision: 124046
URL: http://llvm.org/viewvc/llvm-project?rev=124046&view=rev
Log:
Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times in
"make check" alone.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=124046&r1=124045&r2=124046&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Sat Jan 22 16:06:21 2011
@@ -1035,6 +1035,10 @@
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
More information about the llvm-commits
mailing list