summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ConstantFolding.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-12-12 23:36:14 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-12-12 23:36:14 +0000
commitbb65ebf9a115340e9359dfb955be89164d16d432 (patch)
tree1adcf098755395a2276c2267ca57103daa89bee6 /llvm/lib/VMCore/ConstantFolding.cpp
parenteda561762fe17407f602ff937663ca3eb3b48316 (diff)
downloadbcm5719-llvm-bb65ebf9a115340e9359dfb955be89164d16d432.tar.gz
bcm5719-llvm-bb65ebf9a115340e9359dfb955be89164d16d432.zip
Replace inferred getCast(V,Ty) calls with more strict variants.
Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. llvm-svn: 32514
Diffstat (limited to 'llvm/lib/VMCore/ConstantFolding.cpp')
-rw-r--r--llvm/lib/VMCore/ConstantFolding.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp
index bad774e67fd..170df732723 100644
--- a/llvm/lib/VMCore/ConstantFolding.cpp
+++ b/llvm/lib/VMCore/ConstantFolding.cpp
@@ -743,8 +743,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
(SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
for (unsigned i = 0; i != SrcNumElts; ++i)
Result.push_back(
- ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(i),
- DstEltTy));
+ ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy));
return ConstantPacked::get(Result);
}
@@ -1148,11 +1147,11 @@ static int IdxCompare(Constant *C1, Constant *C2, const Type *ElTy) {
// Ok, we have two differing integer indices. Sign extend them to be the same
// type. Long is always big enough, so we use it.
if (C1->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
- C1 = ConstantExpr::getSignExtend(C1, Type::LongTy);
+ C1 = ConstantExpr::getSExt(C1, Type::LongTy);
else
C1 = ConstantExpr::getBitCast(C1, Type::LongTy);
if (C2->getType() != Type::LongTy && C1->getType() != Type::ULongTy)
- C2 = ConstantExpr::getSignExtend(C2, Type::LongTy);
+ C2 = ConstantExpr::getSExt(C2, Type::LongTy);
else
C2 = ConstantExpr::getBitCast(C2, Type::LongTy);
@@ -1672,7 +1671,7 @@ Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
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());
+ return ConstantExpr::getIntToPtr(R, C->getType());
}
}
}
OpenPOWER on IntegriCloud