From b6dc9352b0d8361609c310699ce58a517fdc2264 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Mon, 3 Nov 2008 23:20:04 +0000 Subject: [PATCH] Fix unused variable warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58653 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/ConstantFold.cpp | 1 + lib/VMCore/Constants.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index fcbda21451b..d84eb2d80b0 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -126,6 +126,7 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) { if (const VectorType *SrcTy = dyn_cast(V->getType())) { assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() && "Not cast between same sized vectors!"); + SrcTy = NULL; // First, check for null. Undef is already handled. if (isa(V)) return Constant::getNullValue(DestTy); diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index ee1872a40e5..55b87009cba 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(SrcTy) == isa(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); } -- 2.11.0