diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-01-17 04:43:56 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-01-17 04:43:56 +0000 |
commit | fdebc38523b397743973ff6a2d2e93b112dd96e5 (patch) | |
tree | 03c93b31dc3e434c640e0180231461400e390529 | |
parent | 21506061ef031a01fce5cc1781f30780fbecb59b (diff) | |
download | external_llvm-fdebc38523b397743973ff6a2d2e93b112dd96e5.zip external_llvm-fdebc38523b397743973ff6a2d2e93b112dd96e5.tar.gz external_llvm-fdebc38523b397743973ff6a2d2e93b112dd96e5.tar.bz2 |
Remove unreachable code. (replace with llvm_unreachable to help GCC where necessary)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148284 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/Host.cpp | 9 | ||||
-rw-r--r-- | lib/Transforms/Scalar/ObjCARC.cpp | 1 | ||||
-rw-r--r-- | lib/Transforms/Utils/BasicBlockUtils.cpp | 1 | ||||
-rw-r--r-- | lib/Transforms/Utils/CmpInstAnalysis.cpp | 1 | ||||
-rw-r--r-- | lib/VMCore/ConstantsContext.h | 1 | ||||
-rw-r--r-- | lib/VMCore/Core.cpp | 3 | ||||
-rw-r--r-- | lib/VMCore/Instruction.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-rtdyld/llvm-rtdyld.cpp | 2 | ||||
-rw-r--r-- | utils/TableGen/CodeGenDAGPatterns.cpp | 3 | ||||
-rw-r--r-- | utils/TableGen/X86DisassemblerTables.cpp | 1 |
11 files changed, 11 insertions, 15 deletions
diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp index 3f3cdca..0f06964 100644 --- a/lib/Support/Host.cpp +++ b/lib/Support/Host.cpp @@ -61,6 +61,8 @@ static bool GetX86CpuIDAndInfo(unsigned value, unsigned *rEAX, *rECX = registers[2]; *rEDX = registers[3]; return false; + #else + return true; #endif #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86) #if defined(__GNUC__) @@ -87,9 +89,14 @@ static bool GetX86CpuIDAndInfo(unsigned value, unsigned *rEAX, mov dword ptr [esi],edx } return false; +// pedantic #else returns to appease -Wunreachable-code (so we don't generate +// postprocessed code that looks like "return true; return false;") + #else + return true; #endif -#endif +#else return true; +#endif } static void DetectX86FamilyModel(unsigned EAX, unsigned &Family, diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp index 756e565..03b287f 100644 --- a/lib/Transforms/Scalar/ObjCARC.cpp +++ b/lib/Transforms/Scalar/ObjCARC.cpp @@ -1886,7 +1886,6 @@ Depends(DependenceKind Flavor, Instruction *Inst, const Value *Arg, } llvm_unreachable("Invalid dependence flavor"); - return true; } /// FindDependencies - Walk up the CFG from StartPos (which is in StartBB) and diff --git a/lib/Transforms/Utils/BasicBlockUtils.cpp b/lib/Transforms/Utils/BasicBlockUtils.cpp index ef4a473..3859a1a 100644 --- a/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -249,7 +249,6 @@ unsigned llvm::GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ) { if (Term->getSuccessor(i) == Succ) return i; } - return 0; } /// SplitEdge - Split the edge connecting specified block. Pass P must diff --git a/lib/Transforms/Utils/CmpInstAnalysis.cpp b/lib/Transforms/Utils/CmpInstAnalysis.cpp index e336e9a..8983e0c 100644 --- a/lib/Transforms/Utils/CmpInstAnalysis.cpp +++ b/lib/Transforms/Utils/CmpInstAnalysis.cpp @@ -59,7 +59,6 @@ unsigned llvm::getICmpCode(const ICmpInst *ICI, bool InvertPred) { // True -> 7 default: llvm_unreachable("Invalid ICmp predicate!"); - return 0; } } diff --git a/lib/VMCore/ConstantsContext.h b/lib/VMCore/ConstantsContext.h index cfcdf13..4ee4296 100644 --- a/lib/VMCore/ConstantsContext.h +++ b/lib/VMCore/ConstantsContext.h @@ -458,7 +458,6 @@ struct ConstantCreator<ConstantExpr, Type, ExprMapKeyType> { return new CompareConstantExpr(Ty, Instruction::FCmp, V.subclassdata, V.operands[0], V.operands[1]); llvm_unreachable("Invalid ConstantExpr!"); - return 0; } }; diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp index 35315df..82edb3a 100644 --- a/lib/VMCore/Core.cpp +++ b/lib/VMCore/Core.cpp @@ -1092,8 +1092,7 @@ LLVMLinkage LLVMGetLinkage(LLVMValueRef Global) { return LLVMCommonLinkage; } - // Should never get here. - return static_cast<LLVMLinkage>(0); + llvm_unreachable("Make GCC's unreachability happy"); } void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage) { diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp index 8c8fbf9..e0e0709 100644 --- a/lib/VMCore/Instruction.cpp +++ b/lib/VMCore/Instruction.cpp @@ -166,8 +166,6 @@ const char *Instruction::getOpcodeName(unsigned OpCode) { default: return "<Invalid operator> "; } - - return 0; } /// isIdenticalTo - Return true if the specified instruction is exactly diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 25bc443..ccb0cbd 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -526,6 +526,4 @@ int main(int argc, char **argv) { case AC_EDisassemble: return DisassembleInput(argv[0], true); } - - return 0; } diff --git a/tools/llvm-rtdyld/llvm-rtdyld.cpp b/tools/llvm-rtdyld/llvm-rtdyld.cpp index 9fec7c4..990582d 100644 --- a/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -163,6 +163,4 @@ int main(int argc, char **argv) { case AC_Execute: return executeInput(); } - - return 0; } diff --git a/utils/TableGen/CodeGenDAGPatterns.cpp b/utils/TableGen/CodeGenDAGPatterns.cpp index ac55320..3880133 100644 --- a/utils/TableGen/CodeGenDAGPatterns.cpp +++ b/utils/TableGen/CodeGenDAGPatterns.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/ErrorHandling.h" #include <set> #include <algorithm> using namespace llvm; @@ -912,7 +913,7 @@ bool SDTypeConstraint::ApplyTypeConstraint(TreePatternNode *N, EnforceVectorSubVectorTypeIs(NodeToApply->getExtType(ResNo), TP); } } - return false; + llvm_unreachable("Make GCC's unreachability happy"); } //===----------------------------------------------------------------------===// diff --git a/utils/TableGen/X86DisassemblerTables.cpp b/utils/TableGen/X86DisassemblerTables.cpp index 61e9452..1336eed 100644 --- a/utils/TableGen/X86DisassemblerTables.cpp +++ b/utils/TableGen/X86DisassemblerTables.cpp @@ -102,7 +102,6 @@ static inline bool inheritsFrom(InstructionContext child, return false; default: llvm_unreachable("Unknown instruction class"); - return false; } } |