Make the trunc code consistent with the zext and sext code in its
authorDan Gohman <gohman@apple.com>
Thu, 24 Jun 2010 16:33:38 +0000 (16:33 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 24 Jun 2010 16:33:38 +0000 (16:33 +0000)
handling of pointer types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106757 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ScalarEvolution.cpp

index 2a18ab449a1d07b277568162156f1c4c2299ece0..24354d4028243f6a0f3b5a7e3606cff2f6704eb4 100644 (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))