summaryrefslogtreecommitdiff
path: root/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-07-25 16:03:30 +0000
committerDan Gohman <gohman@apple.com>2009-07-25 16:03:30 +0000
commit19378d622eebdf94a582555076eab7ba8d5c20ea (patch)
treeeac473b3357be97753f3d02e114d548da4d3e2f9 /lib/Analysis/ScalarEvolution.cpp
parent996b9d6aa9864c24178891adf29eeafd3f34d90c (diff)
downloadllvm-19378d622eebdf94a582555076eab7ba8d5c20ea.tar.gz
llvm-19378d622eebdf94a582555076eab7ba8d5c20ea.tar.bz2
llvm-19378d622eebdf94a582555076eab7ba8d5c20ea.tar.xz
When attempting to sign-extend an addrec by interpreting
the step value as unsigned, the start value and the addrec itself still need to be treated as signed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--lib/Analysis/ScalarEvolution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 49af579366..6592e0d077 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -923,10 +923,10 @@ const SCEV *ScalarEvolution::getSignExtendExpr(const SCEV *Op,
getTruncateOrZeroExtend(Step, Start->getType()));
Add = getAddExpr(Start, UMul);
OperandExtendedAdd =
- getAddExpr(getZeroExtendExpr(Start, WideTy),
+ getAddExpr(getSignExtendExpr(Start, WideTy),
getMulExpr(getZeroExtendExpr(CastedMaxBECount, WideTy),
getZeroExtendExpr(Step, WideTy)));
- if (getZeroExtendExpr(Add, WideTy) == OperandExtendedAdd)
+ if (getSignExtendExpr(Add, WideTy) == OperandExtendedAdd)
// Return the expression with the addrec on the outside.
return getAddRecExpr(getSignExtendExpr(Start, Ty),
getZeroExtendExpr(Step, Ty),