diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-01-20 21:51:11 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-01-20 21:51:11 +0000 |
commit | 4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 (patch) | |
tree | 9a48fa9f7f51fd635f6807ed7444fcdcad0e9bda /lib/VMCore | |
parent | 0041d4d447c26825e566ba38a4fe301471fda1eb (diff) | |
download | external_llvm-4d6ccb5f68cd7c6418a209f1fa4dbade569e4493.zip external_llvm-4d6ccb5f68cd7c6418a209f1fa4dbade569e4493.tar.gz external_llvm-4d6ccb5f68cd7c6418a209f1fa4dbade569e4493.tar.bz2 |
More dead code removal (using -Wunreachable-code)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Core.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Instructions.cpp | 9 | ||||
-rw-r--r-- | lib/VMCore/Metadata.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Pass.cpp | 1 | ||||
-rw-r--r-- | lib/VMCore/ValueTypes.cpp | 2 |
7 files changed, 7 insertions, 18 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 62ef25b..81ad205 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -1908,7 +1908,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, APInt V1 = cast<ConstantInt>(C1)->getValue(); APInt V2 = cast<ConstantInt>(C2)->getValue(); switch (pred) { - default: llvm_unreachable("Invalid ICmp Predicate"); return 0; + default: llvm_unreachable("Invalid ICmp Predicate"); case ICmpInst::ICMP_EQ: return ConstantInt::get(ResultTy, V1 == V2); case ICmpInst::ICMP_NE: return ConstantInt::get(ResultTy, V1 != V2); case ICmpInst::ICMP_SLT: return ConstantInt::get(ResultTy, V1.slt(V2)); @@ -1925,7 +1925,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, APFloat C2V = cast<ConstantFP>(C2)->getValueAPF(); APFloat::cmpResult R = C1V.compare(C2V); switch (pred) { - default: llvm_unreachable("Invalid FCmp Predicate"); return 0; + default: llvm_unreachable("Invalid FCmp Predicate"); case FCmpInst::FCMP_FALSE: return Constant::getNullValue(ResultTy); case FCmpInst::FCMP_TRUE: return Constant::getAllOnesValue(ResultTy); case FCmpInst::FCMP_UNO: diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index ba8c31b..9657cd2 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1241,7 +1241,6 @@ Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty) { switch (opc) { default: llvm_unreachable("Invalid cast opcode"); - break; case Instruction::Trunc: return getTrunc(C, Ty); case Instruction::ZExt: return getZExt(C, Ty); case Instruction::SExt: return getSExt(C, Ty); @@ -1255,7 +1254,6 @@ Constant *ConstantExpr::getCast(unsigned oc, Constant *C, Type *Ty) { case Instruction::IntToPtr: return getIntToPtr(C, Ty); case Instruction::BitCast: return getBitCast(C, Ty); } - return 0; } Constant *ConstantExpr::getZExtOrBitCast(Constant *C, Type *Ty) { @@ -2174,7 +2172,6 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV, Replacement = ConstantExpr::get(getOpcode(), C1, C2, SubclassOptionalData); } else { llvm_unreachable("Unknown ConstantExpr type!"); - return; } assert(Replacement != this && "I didn't contain From!"); diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index ddc2604..ea4e952 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -1617,10 +1617,9 @@ unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr) { Value *V = unwrap(Instr); if (CallInst *CI = dyn_cast<CallInst>(V)) return CI->getCallingConv(); - else if (InvokeInst *II = dyn_cast<InvokeInst>(V)) + if (InvokeInst *II = dyn_cast<InvokeInst>(V)) return II->getCallingConv(); llvm_unreachable("LLVMGetInstructionCallConv applies only to call and invoke!"); - return 0; } void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC) { diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 4784f0c..8c375c2 100644 --- a/lib/VMCore/Instructions.cpp +++ b/lib/VMCore/Instructions.cpp @@ -625,7 +625,6 @@ void ReturnInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) { BasicBlock *ReturnInst::getSuccessorV(unsigned idx) const { llvm_unreachable("ReturnInst has no successors!"); - return 0; } ReturnInst::~ReturnInst() { @@ -655,7 +654,6 @@ void UnwindInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) { BasicBlock *UnwindInst::getSuccessorV(unsigned idx) const { llvm_unreachable("UnwindInst has no successors!"); - return 0; } //===----------------------------------------------------------------------===// @@ -690,7 +688,6 @@ void ResumeInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) { BasicBlock *ResumeInst::getSuccessorV(unsigned idx) const { llvm_unreachable("ResumeInst has no successors!"); - return 0; } //===----------------------------------------------------------------------===// @@ -717,7 +714,6 @@ void UnreachableInst::setSuccessorV(unsigned idx, BasicBlock *NewSucc) { BasicBlock *UnreachableInst::getSuccessorV(unsigned idx) const { llvm_unreachable("UnwindInst has no successors!"); - return 0; } //===----------------------------------------------------------------------===// @@ -2273,7 +2269,6 @@ unsigned CastInst::isEliminableCastPair( assert(0 && "Error in CastResults table!!!"); return 0; } - return 0; } CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty, @@ -2295,8 +2290,8 @@ CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty, case BitCast: return new BitCastInst (S, Ty, Name, InsertBefore); default: assert(0 && "Invalid opcode provided"); + return 0; } - return 0; } CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty, @@ -2318,8 +2313,8 @@ CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty, case BitCast: return new BitCastInst (S, Ty, Name, InsertAtEnd); default: assert(0 && "Invalid opcode provided"); + return 0; } - return 0; } CastInst *CastInst::CreateZExtOrBitCast(Value *S, Type *Ty, diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 993df41..5d6eb14 100644 --- a/lib/VMCore/Metadata.cpp +++ b/lib/VMCore/Metadata.cpp @@ -163,12 +163,13 @@ static const Function *assertLocalFunction(const MDNode *N) { const Function *MDNode::getFunction() const { #ifndef NDEBUG return assertLocalFunction(this); -#endif +#else if (!isFunctionLocal()) return NULL; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) if (const Function *F = getFunctionForValue(getOperand(i))) return F; return NULL; +#endif } // destroy - Delete this node. Only when there are no uses. diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index fca9466..37e1bf2 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -155,7 +155,6 @@ Pass *BasicBlockPass::createPrinterPass(raw_ostream &O, const std::string &Banner) const { llvm_unreachable("BasicBlockPass printing unsupported."); - return 0; } bool BasicBlockPass::doInitialization(Module &) { diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp index a2717af..33a6ecc 100644 --- a/lib/VMCore/ValueTypes.cpp +++ b/lib/VMCore/ValueTypes.cpp @@ -101,7 +101,6 @@ std::string EVT::getEVTString() const { if (isInteger()) return "i" + utostr(getSizeInBits()); llvm_unreachable("Invalid EVT!"); - return "?"; case MVT::i1: return "i1"; case MVT::i8: return "i8"; case MVT::i16: return "i16"; @@ -201,7 +200,6 @@ EVT EVT::getEVT(Type *Ty, bool HandleUnknown){ default: if (HandleUnknown) return MVT(MVT::Other); llvm_unreachable("Unknown type!"); - return MVT::isVoid; case Type::VoidTyID: return MVT::isVoid; case Type::IntegerTyID: |