diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-06 21:50:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-06 21:50:58 +0000 |
commit | 3203f19b1898cf6149db5695a623441ddbf0e054 (patch) | |
tree | dfa819ad566a2ff52d811b795061d5bb12b48cc0 /lib/ExecutionEngine | |
parent | 845e05c8223fcb8e918df5794a50704e9699d7c0 (diff) | |
download | external_llvm-3203f19b1898cf6149db5695a623441ddbf0e054.zip external_llvm-3203f19b1898cf6149db5695a623441ddbf0e054.tar.gz external_llvm-3203f19b1898cf6149db5695a623441ddbf0e054.tar.bz2 |
fix warnings with assertions disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49285 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r-- | lib/ExecutionEngine/Interpreter/Execution.cpp | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/lib/ExecutionEngine/Interpreter/Execution.cpp b/lib/ExecutionEngine/Interpreter/Execution.cpp index 0d9959a..d05e8d0 100644 --- a/lib/ExecutionEngine/Interpreter/Execution.cpp +++ b/lib/ExecutionEngine/Interpreter/Execution.cpp @@ -803,10 +803,10 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I, cast<IntegerType>(I.getOperand()->getType())->getBitWidth(); if (BitWidth == 32) Idx = (int64_t)(int32_t)IdxGV.IntVal.getZExtValue(); - else if (BitWidth == 64) + else { + assert(BitWidth == 64 && "Invalid index type for getelementptr"); Idx = (int64_t)IdxGV.IntVal.getZExtValue(); - else - assert(0 && "Invalid index type for getelementptr"); + } Total += TD.getABITypeSize(ST->getElementType())*Idx; } } @@ -944,48 +944,35 @@ void Interpreter::visitAShr(BinaryOperator &I) { GenericValue Interpreter::executeTruncInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); const IntegerType *DITy = cast<IntegerType>(DstTy); - const IntegerType *SITy = cast<IntegerType>(SrcTy); unsigned DBitWidth = DITy->getBitWidth(); - unsigned SBitWidth = SITy->getBitWidth(); - assert(SBitWidth > DBitWidth && "Invalid truncate"); Dest.IntVal = Src.IntVal.trunc(DBitWidth); return Dest; } GenericValue Interpreter::executeSExtInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); const IntegerType *DITy = cast<IntegerType>(DstTy); - const IntegerType *SITy = cast<IntegerType>(SrcTy); unsigned DBitWidth = DITy->getBitWidth(); - unsigned SBitWidth = SITy->getBitWidth(); - assert(SBitWidth < DBitWidth && "Invalid sign extend"); Dest.IntVal = Src.IntVal.sext(DBitWidth); return Dest; } GenericValue Interpreter::executeZExtInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); const IntegerType *DITy = cast<IntegerType>(DstTy); - const IntegerType *SITy = cast<IntegerType>(SrcTy); unsigned DBitWidth = DITy->getBitWidth(); - unsigned SBitWidth = SITy->getBitWidth(); - assert(SBitWidth < DBitWidth && "Invalid sign extend"); Dest.IntVal = Src.IntVal.zext(DBitWidth); return Dest; } GenericValue Interpreter::executeFPTruncInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); - assert(SrcTy == Type::DoubleTy && DstTy == Type::FloatTy && + assert(SrcVal->getType() == Type::DoubleTy && DstTy == Type::FloatTy && "Invalid FPTrunc instruction"); Dest.FloatVal = (float) Src.DoubleVal; return Dest; @@ -993,9 +980,8 @@ GenericValue Interpreter::executeFPTruncInst(Value *SrcVal, const Type *DstTy, GenericValue Interpreter::executeFPExtInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); - assert(SrcTy == Type::FloatTy && DstTy == Type::DoubleTy && + assert(SrcVal->getType() == Type::FloatTy && DstTy == Type::DoubleTy && "Invalid FPTrunc instruction"); Dest.DoubleVal = (double) Src.FloatVal; return Dest; @@ -1056,10 +1042,9 @@ GenericValue Interpreter::executeSIToFPInst(Value *SrcVal, const Type *DstTy, GenericValue Interpreter::executePtrToIntInst(Value *SrcVal, const Type *DstTy, ExecutionContext &SF) { - const Type *SrcTy = SrcVal->getType(); uint32_t DBitWidth = cast<IntegerType>(DstTy)->getBitWidth(); GenericValue Dest, Src = getOperandValue(SrcVal, SF); - assert(isa<PointerType>(SrcTy) && "Invalid PtrToInt instruction"); + assert(isa<PointerType>(SrcVal->getType()) && "Invalid PtrToInt instruction"); Dest.IntVal = APInt(DBitWidth, (intptr_t) Src.PointerVal); return Dest; |