aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-05 03:30:09 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-05 03:30:09 +0000
commit57c699381bfde5f8d47079cd87e4f3e7fb9fca84 (patch)
treea1ba06c08793ba59d13feacd60f0b8af875e7959 /lib/VMCore/ConstantFold.cpp
parent330d86d7489a961d452e821a34dc6de3f19ae73a (diff)
downloadexternal_llvm-57c699381bfde5f8d47079cd87e4f3e7fb9fca84.zip
external_llvm-57c699381bfde5f8d47079cd87e4f3e7fb9fca84.tar.gz
external_llvm-57c699381bfde5f8d47079cd87e4f3e7fb9fca84.tar.bz2
Remove the last inferred casts from VMCore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32213 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index b15c472..58f1d44 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -777,8 +777,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
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 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
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);
}
@@ -855,7 +853,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
}
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);
}
}
@@ -1644,7 +1642,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
// We know R is unsigned, Idx0 is signed because it must be an index
// through a sequential type (gep pointer operand) which is always
// signed.
- R = ConstantExpr::getInferredCast(R, false, Idx0->getType(), true);
+ R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType());
R = ConstantExpr::getMul(R, Idx0); // signed multiply
// R is a signed integer, C is the GEP pointer so -> IntToPtr
return ConstantExpr::getCast(Instruction::IntToPtr, R, C->getType());
@@ -1676,10 +1674,9 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
if (!Idx0->isNullValue()) {
const Type *IdxTy = Combined->getType();
if (IdxTy != Idx0->getType()) {
- Constant *C1 = ConstantExpr::getInferredCast(
- Idx0, true, Type::LongTy, true);
- Constant *C2 = ConstantExpr::getInferredCast(
- Combined, true, Type::LongTy, true);
+ Constant *C1 = ConstantExpr::getSExtOrBitCast(Idx0, Type::LongTy);
+ Constant *C2 = ConstantExpr::getSExtOrBitCast(Combined,
+ Type::LongTy);
Combined = ConstantExpr::get(Instruction::Add, C1, C2);
} else {
Combined =