summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-01-22 22:06:21 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-01-22 22:06:21 +0000
commitb32c8943e6e03806f81a6e3d7b5a228c89fe746c (patch)
treec78b6da2c20b70603ef16afe57b1fc78476311b8 /llvm/lib/Analysis
parentc70e037b73f21cd638031b2e32c1c8720c684916 (diff)
downloadbcm5719-llvm-b32c8943e6e03806f81a6e3d7b5a228c89fe746c.tar.gz
bcm5719-llvm-b32c8943e6e03806f81a6e3d7b5a228c89fe746c.zip
Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times in
"make check" alone. llvm-svn: 124046
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 424f74427be..63602ffaa78 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -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
OpenPOWER on IntegriCloud