Make the trunc code consistent with the zext and sext code in its

handling of pointer types.

llvm-svn: 106757
This commit is contained in:
Dan Gohman 2010-06-24 16:33:38 +00:00
parent 3f9ceb7916
commit 3ace9f4e3d
1 changed files with 2 additions and 1 deletions

View File

@ -822,7 +822,8 @@ const SCEV *ScalarEvolution::getTruncateExpr(const SCEV *Op,
// Fold if the operand is constant.
if (const SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
return getConstant(
cast<ConstantInt>(ConstantExpr::getTrunc(SC->getValue(), Ty)));
cast<ConstantInt>(ConstantExpr::getTrunc(SC->getValue(),
getEffectiveSCEVType(Ty))));
// trunc(trunc(x)) --> trunc(x)
if (const SCEVTruncateExpr *ST = dyn_cast<SCEVTruncateExpr>(Op))