aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-11-03 23:20:04 +0000
committerDevang Patel <dpatel@apple.com>2008-11-03 23:20:04 +0000
commitb6dc9352b0d8361609c310699ce58a517fdc2264 (patch)
tree1de682747cc0a713b333746a7a49437f2fddddbc /lib/VMCore/Constants.cpp
parent8a88a14462db7e8ad96536c89b3ab948b89d0c2b (diff)
downloadexternal_llvm-b6dc9352b0d8361609c310699ce58a517fdc2264.zip
external_llvm-b6dc9352b0d8361609c310699ce58a517fdc2264.tar.gz
external_llvm-b6dc9352b0d8361609c310699ce58a517fdc2264.tar.bz2
Fix unused variable warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index ee1872a..55b8700 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -1923,8 +1923,10 @@ Constant *ConstantExpr::getFPExtend(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getUIToFP(Constant *C, const Type *Ty) {
+#ifndef NDEBUG
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
bool toVec = Ty->getTypeID() == Type::VectorTyID;
+#endif
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
"This is an illegal uint to floating point cast!");
@@ -1932,8 +1934,10 @@ Constant *ConstantExpr::getUIToFP(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getSIToFP(Constant *C, const Type *Ty) {
+#ifndef NDEBUG
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
bool toVec = Ty->getTypeID() == Type::VectorTyID;
+#endif
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
assert(C->getType()->isIntOrIntVector() && Ty->isFPOrFPVector() &&
"This is an illegal sint to floating point cast!");
@@ -1941,8 +1945,10 @@ Constant *ConstantExpr::getSIToFP(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getFPToUI(Constant *C, const Type *Ty) {
+#ifndef NDEBUG
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
bool toVec = Ty->getTypeID() == Type::VectorTyID;
+#endif
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
"This is an illegal floating point to uint cast!");
@@ -1950,8 +1956,10 @@ Constant *ConstantExpr::getFPToUI(Constant *C, const Type *Ty) {
}
Constant *ConstantExpr::getFPToSI(Constant *C, const Type *Ty) {
+#ifndef NDEBUG
bool fromVec = C->getType()->getTypeID() == Type::VectorTyID;
bool toVec = Ty->getTypeID() == Type::VectorTyID;
+#endif
assert((fromVec == toVec) && "Cannot convert from scalar to/from vector");
assert(C->getType()->isFPOrFPVector() && Ty->isIntOrIntVector() &&
"This is an illegal floating point to sint cast!");
@@ -1973,6 +1981,7 @@ Constant *ConstantExpr::getIntToPtr(Constant *C, const Type *DstTy) {
Constant *ConstantExpr::getBitCast(Constant *C, const Type *DstTy) {
// BitCast implies a no-op cast of type only. No bits change. However, you
// can't cast pointers to anything but pointers.
+#ifndef NDEBUG
const Type *SrcTy = C->getType();
assert((isa<PointerType>(SrcTy) == isa<PointerType>(DstTy)) &&
"BitCast cannot cast pointer to non-pointer and vice versa");
@@ -1982,6 +1991,7 @@ Constant *ConstantExpr::getBitCast(Constant *C, const Type *DstTy) {
// destination bit widths are identical.
unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits();
unsigned DstBitSize = DstTy->getPrimitiveSizeInBits();
+#endif
assert(SrcBitSize == DstBitSize && "BitCast requies types of same width");
return getFoldedCast(Instruction::BitCast, C, DstTy);
}
@@ -2365,8 +2375,10 @@ Constant *ConstantExpr::getInsertValue(Constant *Agg, Constant *Val,
"Tried to create insertelement operation on non-first-class type!");
const Type *ReqTy = Agg->getType();
+#ifndef NDEBUG
const Type *ValTy =
ExtractValueInst::getIndexedType(Agg->getType(), IdxList, IdxList+NumIdx);
+#endif
assert(ValTy == Val->getType() && "insertvalue indices invalid!");
return getInsertValueTy(ReqTy, Agg, Val, IdxList, NumIdx);
}