From 0658f6118c14ea919ad55e7207f80e2228c34454 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77078 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ScalarEvolution.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 49af579..6592e0d 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), -- cgit v1.1