Fix constant folding of fp->int bitcast for vectors.

llvm-svn: 34880
This commit is contained in:
Reid Spencer 2007-03-03 08:32:46 +00:00
parent 36fb227e99
commit 6037b564a0

View File

@ -86,9 +86,9 @@ static Constant *CastConstantVector(ConstantVector *CV,
if (SrcEltTy->getTypeID() == Type::DoubleTyID) {
for (unsigned i = 0; i != SrcNumElts; ++i) {
double V =
uint64_t V =
DoubleToBits(cast<ConstantFP>(CV->getOperand(i))->getValue());
Constant *C = ConstantInt::get(APIntOps::RoundDoubleToAPInt(V));
Constant *C = ConstantInt::get(Type::Int64Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
}
return ConstantVector::get(Result);