[llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp

Chris Lattner clattner at apple.com
Tue Dec 5 15:08:53 PST 2006


nice, thanks Reid!

-Chris

On Dec 5, 2006, at 2:40 PM, Reid Spencer wrote:

>
>
> Changes in directory llvm/lib/Analysis:
>
> ScalarEvolution.cpp updated: 1.64 -> 1.65
> ---
> Log message:
>
> Finally get the casting right in this file. Also, remove some  
> unnecessary
> casting because sdiv doesn't require operand signs to match any more.
>
>
> ---
> Diffs of the changes:  (+6 -7)
>
>  ScalarEvolution.cpp |   13 ++++++-------
>  1 files changed, 6 insertions(+), 7 deletions(-)
>
>
> Index: llvm/lib/Analysis/ScalarEvolution.cpp
> diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.64 llvm/lib/ 
> Analysis/ScalarEvolution.cpp:1.65
> --- llvm/lib/Analysis/ScalarEvolution.cpp:1.64	Tue Dec  5 13:14:13  
> 2006
> +++ llvm/lib/Analysis/ScalarEvolution.cpp	Tue Dec  5 16:39:58 2006
> @@ -560,7 +560,7 @@
>  SCEVHandle SCEVTruncateExpr::get(const SCEVHandle &Op, const Type  
> *Ty) {
>    if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
>      return SCEVUnknown::get(
> -        ConstantExpr::getTruncOrBitCast(SC->getValue(), Ty));
> +        ConstantExpr::getTrunc(SC->getValue(), Ty));
>
>    // If the input value is a chrec scev made out of constants,  
> truncate
>    // all of the constants.
> @@ -584,7 +584,7 @@
>  SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const  
> Type *Ty) {
>    if (SCEVConstant *SC = dyn_cast<SCEVConstant>(Op))
>      return SCEVUnknown::get(
> -        ConstantExpr::getZExtOrBitCast(SC->getValue(), Ty));
> +        ConstantExpr::getZeroExtend(SC->getValue(), Ty));
>
>    // FIXME: If the input value is a chrec scev, and we can prove  
> that the value
>    // did not overflow the old, smaller, value, we can zero extend  
> all of the
> @@ -999,11 +999,6 @@
>      if (SCEVConstant *LHSC = dyn_cast<SCEVConstant>(LHS)) {
>        Constant *LHSCV = LHSC->getValue();
>        Constant *RHSCV = RHSC->getValue();
> -      if (LHSCV->getType()->isUnsigned())
> -        LHSCV = ConstantExpr::getBitCast(LHSCV,
> -                                         LHSCV->getType()- 
> >getSignedVersion());
> -      if (RHSCV->getType()->isUnsigned())
> -        RHSCV = ConstantExpr::getBitCast(RHSCV, LHSCV->getType());
>        return SCEVUnknown::get(ConstantExpr::getSDiv(LHSCV, RHSCV));
>      }
>    }
> @@ -1376,12 +1371,16 @@
>        break;
>
>      case Instruction::Trunc:
> +      // We must prevent boolean types such as setne, etc. from  
> entering here
> +      // because we don't want to pass SCEVUnknown to the  
> TruncateExpr.
>        if (I->getType()->isInteger() && I->getOperand(0)->getType()- 
> >isInteger())
>          return SCEVTruncateExpr::get(getSCEV(I->getOperand(0)),
>                                       I->getType()- 
> >getUnsignedVersion());
>        break;
>
>      case Instruction::ZExt:
> +      // We must prevent boolean types such as setne, etc. from  
> entering here
> +      // because we don't want to pass SCEVUnknown to the ZExtExpr.
>        if (I->getType()->isInteger() && I->getOperand(0)->getType()- 
> >isInteger())
>          return SCEVZeroExtendExpr::get(getSCEV(I->getOperand(0)),
>                                         I->getType()- 
> >getUnsignedVersion());
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list