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

Chris Lattner clattner at apple.com
Mon Dec 11 21:27:59 PST 2006


> Index: llvm/lib/Analysis/ScalarEvolution.cpp
> diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/ 
> Analysis/ScalarEvolution.cpp:1.70
> --- llvm/lib/Analysis/ScalarEvolution.cpp:1.69	Mon Dec 11 20:26:09  
> 2006
> +++ llvm/lib/Analysis/ScalarEvolution.cpp	Mon Dec 11 23:04:59 2006
> @@ -1566,7 +1566,9 @@
>          // comparison.
>          ConstantInt *CompVal = RHSC->getValue();
>          const Type *RealTy = ExitCond->getOperand(0)->getType();
> -        CompVal = dyn_cast<ConstantInt>(ConstantExpr::getCast 
> (CompVal, RealTy));
> +        CompVal = dyn_cast<ConstantInt>(
> +          ConstantExpr::getIntegerCast(CompVal, RealTy,
> +                                       CompVal->getType()->isSigned 
> ()));
>          if (CompVal) {
>            // Form the constant range.
>            ConstantRange CompRange(Cond, CompVal);
> @@ -1575,8 +1577,12 @@
>            // range.
>            if (CompRange.getLower()->getType()->isSigned()) {
>              const Type *NewTy = RHSC->getValue()->getType();
> -            Constant *NewL = ConstantExpr::getCast 
> (CompRange.getLower(), NewTy);
> -            Constant *NewU = ConstantExpr::getCast 
> (CompRange.getUpper(), NewTy);
> +            Constant *NewL =
> +              ConstantExpr::getIntegerCast(CompRange.getLower(),  
> NewTy,
> +                 CompRange.getLower()->getType()->isSigned());
> +            Constant *NewU =
> +              ConstantExpr::getIntegerCast(CompRange.getUpper(),  
> NewTy,
> +                 CompRange.getUpper()->getType()->isSigned());
>              CompRange = ConstantRange(NewL, NewU);
>            }

I believe all of these are bitcasts.  The later two certainly are.

-Chris



More information about the llvm-commits mailing list