From 534d66a426c9c97802a18815c01433d8695c2b2b Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sat, 25 Jul 2009 16:03:30 +0000 Subject: 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. llvm-svn: 77078 --- llvm/lib/Analysis/ScalarEvolution.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 49af5793662..6592e0d0778 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/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), -- cgit v1.2.3