aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-01-17 04:43:56 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-01-17 04:43:56 +0000
commitfdebc38523b397743973ff6a2d2e93b112dd96e5 (patch)
tree03c93b31dc3e434c640e0180231461400e390529 /lib
parent21506061ef031a01fce5cc1781f30780fbecb59b (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/Support/Host.cpp9
-rw-r--r--lib/Transforms/Scalar/ObjCARC.cpp1
-rw-r--r--lib/Transforms/Utils/BasicBlockUtils.cpp1
-rw-r--r--lib/Transforms/Utils/CmpInstAnalysis.cpp1
-rw-r--r--lib/VMCore/ConstantsContext.h1
-rw-r--r--lib/VMCore/Core.cpp3
-rw-r--r--lib/VMCore/Instruction.cpp2
7 files changed, 9 insertions, 9 deletions
diff --git a/lib/Support/Host.cpp b/lib/Support/Host.cpp
index 3f3cdca27f..0f0696438c 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 756e56579d..03b287f175 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 ef4a47361e..3859a1aec4 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 e336e9a5a2..8983e0c4f0 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 cfcdf134ab..4ee4296d44 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 35315df220..82edb3a4e6 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 8c8fbf9acd..e0e07099c5 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