[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner clattner at apple.com
Mon Dec 4 22:52:38 PST 2006


> Index: llvm/lib/VMCore/ConstantFolding.cpp
> diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.107 llvm/lib/VMCore/ 
> ConstantFolding.cpp:1.108
> --- llvm/lib/VMCore/ConstantFolding.cpp:1.107	Sun Dec  3 23:19:34 2006
> +++ llvm/lib/VMCore/ConstantFolding.cpp	Mon Dec  4 21:30:09 2006
> @@ -777,8 +777,7 @@
>          uint64_t V =
>            DoubleToBits(cast<ConstantFP>(CP->getOperand(i))- 
> >getValue());
>          Constant *C = ConstantInt::get(Type::ULongTy, V);
> -        Result.push_back(
> -            ConstantExpr::getInferredCast(C, false, DstEltTy,  
> false));
> +        Result.push_back(ConstantExpr::getTruncOrBitCast(C,  
> DstEltTy ));
>        }
>        return ConstantPacked::get(Result);
>      }
> @@ -787,8 +786,7 @@
>      for (unsigned i = 0; i != SrcNumElts; ++i) {
>        uint32_t V = FloatToBits(cast<ConstantFP>(CP->getOperand(i))- 
> >getValue());
>        Constant *C = ConstantInt::get(Type::UIntTy, V);
> -      Result.push_back(
> -        ConstantExpr::getInferredCast(C, false, DstEltTy, false));
> +      Result.push_back(ConstantExpr::getTruncOrBitCast(C, DstEltTy));
>      }
>      return ConstantPacked::get(Result);
>    }

Again, these should only be bitcast.  They can never be truncates.

> @@ -855,7 +853,7 @@
>          }
>        if (isAllNull)
>          // This is casting one pointer type to another, always  
> BitCast
> -        return ConstantExpr::getCast(CE->getOperand(0), DestTy);
> +        return ConstantExpr::getPointerCast(CE->getOperand(0),  
> DestTy);
>      }
>    }

Likewise.

-Chris





More information about the llvm-commits mailing list