aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/BitVector.h19
-rw-r--r--include/llvm/ADT/ImmutableSet.h7
-rw-r--r--include/llvm/ADT/SmallBitVector.h6
-rw-r--r--include/llvm/ADT/SparseBitVector.h22
-rw-r--r--include/llvm/ADT/Trie.h6
-rw-r--r--include/llvm/ADT/Twine.h3
-rw-r--r--include/llvm/Analysis/IntervalIterator.h4
-rw-r--r--include/llvm/Analysis/ProfileInfo.h9
-rw-r--r--include/llvm/Bitcode/BitCodes.h6
-rw-r--r--include/llvm/Bitcode/BitstreamReader.h4
-rw-r--r--include/llvm/Bitcode/BitstreamWriter.h2
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h6
-rw-r--r--include/llvm/CodeGen/PBQP/HeuristicBase.h14
-rw-r--r--include/llvm/CodeGen/ScheduleDAG.h3
-rw-r--r--include/llvm/CodeGen/SelectionDAG.h2
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h12
-rw-r--r--include/llvm/CodeGen/ValueTypes.h13
-rw-r--r--include/llvm/Constant.h9
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h10
-rw-r--r--include/llvm/MC/MCAsmBackend.h5
-rw-r--r--include/llvm/MC/MCFixup.h3
-rw-r--r--include/llvm/MC/MCRegisterInfo.h4
-rw-r--r--include/llvm/Support/CommandLine.h2
-rw-r--r--include/llvm/Support/Recycler.h3
-rw-r--r--include/llvm/TableGen/Record.h30
-rw-r--r--include/llvm/Target/TargetInstrInfo.h14
-rw-r--r--include/llvm/Target/TargetJITInfo.h16
-rw-r--r--include/llvm/Target/TargetLowering.h26
-rw-r--r--include/llvm/Target/TargetRegisterInfo.h14
-rw-r--r--include/llvm/User.h5
-rw-r--r--lib/VMCore/Constants.cpp7
-rw-r--r--lib/VMCore/Core.cpp6
-rw-r--r--lib/VMCore/Instructions.cpp34
-rw-r--r--lib/VMCore/PassManager.cpp3
-rw-r--r--lib/VMCore/ValueTypes.cpp3
35 files changed, 144 insertions, 188 deletions
diff --git a/include/llvm/ADT/BitVector.h b/include/llvm/ADT/BitVector.h
index d5f247b..7e0b5ba 100644
--- a/include/llvm/ADT/BitVector.h
+++ b/include/llvm/ADT/BitVector.h
@@ -14,12 +14,12 @@
#ifndef LLVM_ADT_BITVECTOR_H
#define LLVM_ADT_BITVECTOR_H
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdlib>
-#include <cstring>
namespace llvm {
@@ -116,7 +116,7 @@ public:
else if (sizeof(BitWord) == 8)
NumBits += CountPopulation_64(Bits[i]);
else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
return NumBits;
}
@@ -146,10 +146,9 @@ public:
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return -1;
}
@@ -170,10 +169,9 @@ public:
if (Copy != 0) {
if (sizeof(BitWord) == 4)
return WordPos * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Copy);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return WordPos * BITWORD_SIZE + CountTrailingZeros_64(Copy);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
// Check subsequent words.
@@ -181,10 +179,9 @@ public:
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return -1;
}
diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h
index d597a7c..2926462 100644
--- a/include/llvm/ADT/ImmutableSet.h
+++ b/include/llvm/ADT/ImmutableSet.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <functional>
#include <vector>
@@ -686,7 +687,7 @@ public:
stack.back() |= VisitedRight;
break;
default:
- assert(false && "Unreachable.");
+ llvm_unreachable("Unreachable.");
}
}
@@ -722,7 +723,7 @@ public:
skipToParent();
break;
default:
- assert(false && "Unreachable.");
+ llvm_unreachable("Unreachable.");
}
return *this;
}
@@ -747,7 +748,7 @@ public:
stack.push_back(reinterpret_cast<uintptr_t>(R) | VisitedRight);
break;
default:
- assert(false && "Unreachable.");
+ llvm_unreachable("Unreachable.");
}
return *this;
}
diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h
index b15b3ee..a3469a1 100644
--- a/include/llvm/ADT/SmallBitVector.h
+++ b/include/llvm/ADT/SmallBitVector.h
@@ -175,7 +175,7 @@ public:
return CountPopulation_32(Bits);
if (sizeof(uintptr_t) * CHAR_BIT == 64)
return CountPopulation_64(Bits);
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return getPointer()->count();
}
@@ -212,7 +212,7 @@ public:
return CountTrailingZeros_32(Bits);
if (sizeof(uintptr_t) * CHAR_BIT == 64)
return CountTrailingZeros_64(Bits);
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return getPointer()->find_first();
}
@@ -230,7 +230,7 @@ public:
return CountTrailingZeros_32(Bits);
if (sizeof(uintptr_t) * CHAR_BIT == 64)
return CountTrailingZeros_64(Bits);
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return getPointer()->find_next(Prev);
}
diff --git a/include/llvm/ADT/SparseBitVector.h b/include/llvm/ADT/SparseBitVector.h
index d977136..7c824ee 100644
--- a/include/llvm/ADT/SparseBitVector.h
+++ b/include/llvm/ADT/SparseBitVector.h
@@ -18,11 +18,11 @@
#include "llvm/ADT/ilist.h"
#include "llvm/ADT/ilist_node.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <climits>
-#include <cstring>
namespace llvm {
@@ -128,7 +128,7 @@ public:
else if (sizeof(BitWord) == 8)
NumBits += CountPopulation_64(Bits[i]);
else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
return NumBits;
}
@@ -138,13 +138,11 @@ public:
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
- assert(0 && "Illegal empty element");
- return 0; // Not reached
+ llvm_unreachable("Illegal empty element");
}
/// find_next - Returns the index of the next set bit starting from the
@@ -165,10 +163,9 @@ public:
if (Copy != 0) {
if (sizeof(BitWord) == 4)
return WordPos * BITWORD_SIZE + CountTrailingZeros_32(Copy);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return WordPos * BITWORD_SIZE + CountTrailingZeros_64(Copy);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
// Check subsequent words.
@@ -176,10 +173,9 @@ public:
if (Bits[i] != 0) {
if (sizeof(BitWord) == 4)
return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
- else if (sizeof(BitWord) == 8)
+ if (sizeof(BitWord) == 8)
return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
- else
- assert(0 && "Unsupported!");
+ llvm_unreachable("Unsupported!");
}
return -1;
}
diff --git a/include/llvm/ADT/Trie.h b/include/llvm/ADT/Trie.h
index 6b150c8..845af01 100644
--- a/include/llvm/ADT/Trie.h
+++ b/include/llvm/ADT/Trie.h
@@ -220,8 +220,7 @@ bool Trie<Payload>::addString(const std::string& s, const Payload& data) {
assert(0 && "FIXME!");
return false;
case Node::DontMatch:
- assert(0 && "Impossible!");
- return false;
+ llvm_unreachable("Impossible!");
case Node::LabelIsPrefix:
s1 = s1.substr(nNode->label().length());
cNode = nNode;
@@ -258,8 +257,7 @@ const Payload& Trie<Payload>::lookup(const std::string& s) const {
case Node::StringIsPrefix:
return Empty;
case Node::DontMatch:
- assert(0 && "Impossible!");
- return Empty;
+ llvm_unreachable("Impossible!");
case Node::LabelIsPrefix:
s1 = s1.substr(nNode->label().length());
cNode = nNode;
diff --git a/include/llvm/ADT/Twine.h b/include/llvm/ADT/Twine.h
index 3a60cab..9101df8 100644
--- a/include/llvm/ADT/Twine.h
+++ b/include/llvm/ADT/Twine.h
@@ -12,6 +12,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <string>
@@ -425,7 +426,7 @@ namespace llvm {
StringRef getSingleStringRef() const {
assert(isSingleStringRef() &&"This cannot be had as a single stringref!");
switch (getLHSKind()) {
- default: assert(0 && "Out of sync with isSingleStringRef");
+ default: llvm_unreachable("Out of sync with isSingleStringRef");
case EmptyKind: return StringRef();
case CStringKind: return StringRef(LHS.cString);
case StdStringKind: return StringRef(*LHS.stdString);
diff --git a/include/llvm/Analysis/IntervalIterator.h b/include/llvm/Analysis/IntervalIterator.h
index 82b3294..0968c74 100644
--- a/include/llvm/Analysis/IntervalIterator.h
+++ b/include/llvm/Analysis/IntervalIterator.h
@@ -101,14 +101,14 @@ public:
IntervalIterator(Function *M, bool OwnMemory) : IOwnMem(OwnMemory) {
OrigContainer = M;
if (!ProcessInterval(&M->front())) {
- assert(0 && "ProcessInterval should never fail for first interval!");
+ llvm_unreachable("ProcessInterval should never fail for first interval!");
}
}
IntervalIterator(IntervalPartition &IP, bool OwnMemory) : IOwnMem(OwnMemory) {
OrigContainer = &IP;
if (!ProcessInterval(IP.getRootInterval())) {
- assert(0 && "ProcessInterval should never fail for first interval!");
+ llvm_unreachable("ProcessInterval should never fail for first interval!");
}
}
diff --git a/include/llvm/Analysis/ProfileInfo.h b/include/llvm/Analysis/ProfileInfo.h
index 300a027..6c2e273 100644
--- a/include/llvm/Analysis/ProfileInfo.h
+++ b/include/llvm/Analysis/ProfileInfo.h
@@ -22,6 +22,7 @@
#define LLVM_ANALYSIS_PROFILEINFO_H
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
@@ -85,13 +86,11 @@ namespace llvm {
// getFunction() - Returns the Function for an Edge, checking for validity.
static const FType* getFunction(Edge e) {
- if (e.first) {
+ if (e.first)
return e.first->getParent();
- } else if (e.second) {
+ if (e.second)
return e.second->getParent();
- }
- assert(0 && "Invalid ProfileInfo::Edge");
- return (const FType*)0;
+ llvm_unreachable("Invalid ProfileInfo::Edge");
}
// getEdge() - Creates an Edge from two BasicBlocks.
diff --git a/include/llvm/Bitcode/BitCodes.h b/include/llvm/Bitcode/BitCodes.h
index fa1325e..172ce6e 100644
--- a/include/llvm/Bitcode/BitCodes.h
+++ b/include/llvm/Bitcode/BitCodes.h
@@ -140,8 +140,7 @@ public:
if (C >= '0' && C <= '9') return C-'0'+26+26;
if (C == '.') return 62;
if (C == '_') return 63;
- assert(0 && "Not a value Char6 character!");
- return 0;
+ llvm_unreachable("Not a value Char6 character!");
}
static char DecodeChar6(unsigned V) {
@@ -151,8 +150,7 @@ public:
if (V < 26+26+10) return V-26-26+'0';
if (V == 62) return '.';
if (V == 63) return '_';
- assert(0 && "Not a value Char6 character!");
- return ' ';
+ llvm_unreachable("Not a value Char6 character!");
}
};
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h
index 0437f53..e943e3c 100644
--- a/include/llvm/Bitcode/BitstreamReader.h
+++ b/include/llvm/Bitcode/BitstreamReader.h
@@ -455,10 +455,10 @@ private:
void ReadAbbreviatedField(const BitCodeAbbrevOp &Op,
SmallVectorImpl<uint64_t> &Vals) {
assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!");
-
+
// Decode the value as we are commanded.
switch (Op.getEncoding()) {
- default: assert(0 && "Unknown encoding!");
+ default: llvm_unreachable("Unknown encoding!");
case BitCodeAbbrevOp::Fixed:
Vals.push_back(Read((unsigned)Op.getEncodingData()));
break;
diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h
index bfb3a4e..41e3e08 100644
--- a/include/llvm/Bitcode/BitstreamWriter.h
+++ b/include/llvm/Bitcode/BitstreamWriter.h
@@ -275,7 +275,7 @@ private:
// Encode the value as we are commanded.
switch (Op.getEncoding()) {
- default: assert(0 && "Unknown encoding!");
+ default: llvm_unreachable("Unknown encoding!");
case BitCodeAbbrevOp::Fixed:
if (Op.getEncodingData())
Emit((unsigned)V, (unsigned)Op.getEncodingData());
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 50bb8e4..8e64ee1 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -18,6 +18,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
namespace llvm {
class BlockAddress;
@@ -37,7 +38,6 @@ namespace llvm {
class MachineModuleInfo;
class MachineMove;
class MCAsmInfo;
- class MCInst;
class MCContext;
class MCSection;
class MCStreamer;
@@ -49,8 +49,6 @@ namespace llvm {
class TargetLoweringObjectFile;
class TargetData;
class TargetMachine;
- class Twine;
- class Type;
/// AsmPrinter - This class is intended to be used as a driving class for all
/// asm writers.
@@ -254,7 +252,7 @@ namespace llvm {
/// EmitInstruction - Targets should implement this to emit instructions.
virtual void EmitInstruction(const MachineInstr *) {
- assert(0 && "EmitInstruction not implemented");
+ llvm_unreachable("EmitInstruction not implemented");
}
virtual void EmitFunctionEntryLabel();
diff --git a/include/llvm/CodeGen/PBQP/HeuristicBase.h b/include/llvm/CodeGen/PBQP/HeuristicBase.h
index 791c227..3fee18c 100644
--- a/include/llvm/CodeGen/PBQP/HeuristicBase.h
+++ b/include/llvm/CodeGen/PBQP/HeuristicBase.h
@@ -157,7 +157,7 @@ namespace PBQP {
case 0: s.applyR0(nItr); break;
case 1: s.applyR1(nItr); break;
case 2: s.applyR2(nItr); break;
- default: assert(false &&
+ default: llvm_unreachable(
"Optimal reductions of degree > 2 nodes is invalid.");
}
@@ -186,7 +186,7 @@ namespace PBQP {
/// \brief Add a node to the heuristic reduce list.
/// @param nItr Node iterator to add to the heuristic reduce list.
void addToHeuristicList(Graph::NodeItr nItr) {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Heuristically reduce one of the nodes in the heuristic
@@ -194,25 +194,25 @@ namespace PBQP {
/// @return True if a reduction takes place, false if the heuristic reduce
/// list is empty.
void heuristicReduce() {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Prepare a change in the costs on the given edge.
/// @param eItr Edge iterator.
void preUpdateEdgeCosts(Graph::EdgeItr eItr) {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Handle the change in the costs on the given edge.
/// @param eItr Edge iterator.
void postUpdateEdgeCostts(Graph::EdgeItr eItr) {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Handle the addition of a new edge into the PBQP graph.
/// @param eItr Edge iterator for the added edge.
void handleAddEdge(Graph::EdgeItr eItr) {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Handle disconnection of an edge from a node.
@@ -223,7 +223,7 @@ namespace PBQP {
/// method allows for the effect to be computed only for the remaining
/// node in the graph.
void handleRemoveEdge(Graph::EdgeItr eItr, Graph::NodeItr nItr) {
- assert(false && "Must be implemented in derived class.");
+ llvm_unreachable("Must be implemented in derived class.");
}
/// \brief Clean up any structures used by HeuristicBase.
diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h
index 58a3a9c..fdf40c7 100644
--- a/include/llvm/CodeGen/ScheduleDAG.h
+++ b/include/llvm/CodeGen/ScheduleDAG.h
@@ -128,9 +128,8 @@ namespace llvm {
Other.Contents.Order.isNormalMemory &&
Contents.Order.isMustAlias == Other.Contents.Order.isMustAlias &&
Contents.Order.isArtificial == Other.Contents.Order.isArtificial;
+ default: llvm_unreachable("Invalid dependency kind!");
}
- assert(0 && "Invalid dependency kind!");
- return false;
}
bool operator!=(const SDep &Other) const {
diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h
index 8ffca44..f921ca2 100644
--- a/include/llvm/CodeGen/SelectionDAG.h
+++ b/include/llvm/CodeGen/SelectionDAG.h
@@ -51,7 +51,7 @@ public:
static void noteHead(SDNode*, SDNode*) {}
static void deleteNode(SDNode *) {
- assert(0 && "ilist_traits<SDNode> shouldn't see a deleteNode call!");
+ llvm_unreachable("ilist_traits<SDNode> shouldn't see a deleteNode call!");
}
private:
static void createNode(const SDNode &);
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index c466175..ee3f231 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -240,8 +240,7 @@ public:
/// succeeds or false if it fails. The number is a private implementation
/// detail to the code tblgen produces.
virtual bool CheckPatternPredicate(unsigned PredNo) const {
- assert(0 && "Tblgen should generate the implementation of this!");
- return 0;
+ llvm_unreachable("Tblgen should generate the implementation of this!");
}
/// CheckNodePredicate - This function is generated by tblgen in the target.
@@ -249,20 +248,17 @@ public:
/// false if it fails. The number is a private implementation
/// detail to the code tblgen produces.
virtual bool CheckNodePredicate(SDNode *N, unsigned PredNo) const {
- assert(0 && "Tblgen should generate the implementation of this!");
- return 0;
+ llvm_unreachable("Tblgen should generate the implementation of this!");
}
virtual bool CheckComplexPattern(SDNode *Root, SDNode *Parent, SDValue N,
unsigned PatternNo,
SmallVectorImpl<std::pair<SDValue, SDNode*> > &Result) {
- assert(0 && "Tblgen should generate the implementation of this!");
- return false;
+ llvm_unreachable("Tblgen should generate the implementation of this!");
}
virtual SDValue RunSDNodeXForm(SDValue V, unsigned XFormNo) {
- assert(0 && "Tblgen should generate this!");
- return SDValue();
+ llvm_unreachable("Tblgen should generate this!");
}
SDNode *SelectCodeCommon(SDNode *NodeToMatch,
diff --git a/include/llvm/CodeGen/ValueTypes.h b/include/llvm/CodeGen/ValueTypes.h
index eb0793e..d163403 100644
--- a/include/llvm/CodeGen/ValueTypes.h
+++ b/include/llvm/CodeGen/ValueTypes.h
@@ -16,10 +16,11 @@
#ifndef LLVM_CODEGEN_VALUETYPES_H
#define LLVM_CODEGEN_VALUETYPES_H
-#include <cassert>
-#include <string>
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
+#include <cassert>
+#include <string>
namespace llvm {
class Type;
@@ -246,13 +247,13 @@ namespace llvm {
unsigned getSizeInBits() const {
switch (SimpleTy) {
case iPTR:
- assert(0 && "Value type size is target-dependent. Ask TLI.");
+ llvm_unreachable("Value type size is target-dependent. Ask TLI.");
case iPTRAny:
case iAny:
case fAny:
- assert(0 && "Value type is overloaded.");
+ llvm_unreachable("Value type is overloaded.");
default:
- assert(0 && "getSizeInBits called on extended MVT.");
+ llvm_unreachable("getSizeInBits called on extended MVT.");
case i1 : return 1;
case i8 : return 8;
case i16 :
@@ -306,7 +307,7 @@ namespace llvm {
static MVT getFloatingPointVT(unsigned BitWidth) {
switch (BitWidth) {
default:
- assert(false && "Bad bit width!");
+ llvm_unreachable("Bad bit width!");
case 16:
return MVT::f16;
case 32:
diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h
index 11a02e0..13acdc6 100644
--- a/include/llvm/Constant.h
+++ b/include/llvm/Constant.h
@@ -105,7 +105,7 @@ public:
/// available cached constants. Implementations should call
/// destroyConstantImpl as the last thing they do, to destroy all users and
/// delete this.
- virtual void destroyConstant() { assert(0 && "Not reached!"); }
+ virtual void destroyConstant() { llvm_unreachable("Not reached!"); }
//// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const Constant *) { return true; }
@@ -131,11 +131,12 @@ public:
// to be here to avoid link errors.
assert(getNumOperands() == 0 && "replaceUsesOfWithOnConstant must be "
"implemented for all constants that have operands!");
- assert(0 && "Constants that do not have operands cannot be using 'From'!");
+ llvm_unreachable("Constants that do not have operands cannot be using "
+ "'From'!");
}
-
+
static Constant *getNullValue(Type* Ty);
-
+
/// @returns the value for an integer constant of the given type that has all
/// its bits set to true.
/// @brief Get the all ones value
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 62adb55..9f56ed1 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -15,18 +15,19 @@
#ifndef LLVM_EXECUTION_ENGINE_H
#define LLVM_EXECUTION_ENGINE_H
-#include <vector>
-#include <map>
-#include <string>
#include "llvm/MC/MCCodeGenInfo.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/ValueMap.h"
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
+#include <vector>
+#include <map>
+#include <string>
namespace llvm {
@@ -244,7 +245,8 @@ public:
/// to the address in the target process as the running code will see it.
/// This is the address which will be used for relocation resolution.
virtual void mapSectionAddress(void *LocalAddress, uint64_t TargetAddress) {
- assert(0 && "Re-mapping of section addresses not supported with this EE!");
+ llvm_unreachable("Re-mapping of section addresses not supported with this "
+ "EE!");
}
/// runStaticConstructorsDestructors - This method is used to execute all of
diff --git a/include/llvm/MC/MCAsmBackend.h b/include/llvm/MC/MCAsmBackend.h
index 26d69f2..11a081b 100644
--- a/include/llvm/MC/MCAsmBackend.h
+++ b/include/llvm/MC/MCAsmBackend.h
@@ -14,6 +14,7 @@
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFixupKindInfo.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
namespace llvm {
class MCAsmLayout;
@@ -49,8 +50,8 @@ public:
/// createELFObjectTargetWriter - Create a new ELFObjectTargetWriter to enable
/// non-standard ELFObjectWriters.
virtual MCELFObjectTargetWriter *createELFObjectTargetWriter() const {
- assert(0 && "createELFObjectTargetWriter is not supported by asm backend");
- return 0;
+ llvm_unreachable("createELFObjectTargetWriter is not supported by asm "
+ "backend");
}
/// hasReliableSymbolDifference - Check whether this target implements
diff --git a/include/llvm/MC/MCFixup.h b/include/llvm/MC/MCFixup.h
index aaf5fe1..16e9eb7 100644
--- a/include/llvm/MC/MCFixup.h
+++ b/include/llvm/MC/MCFixup.h
@@ -11,6 +11,7 @@
#define LLVM_MC_MCFIXUP_H
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/SMLoc.h"
#include <cassert>
@@ -95,7 +96,7 @@ public:
/// size. It is an error to pass an unsupported size.
static MCFixupKind getKindForSize(unsigned Size, bool isPCRel) {
switch (Size) {
- default: assert(0 && "Invalid generic fixup size!");
+ default: llvm_unreachable("Invalid generic fixup size!");
case 1: return isPCRel ? FK_PCRel_1 : FK_Data_1;
case 2: return isPCRel ? FK_PCRel_2 : FK_Data_2;
case 4: return isPCRel ? FK_PCRel_4 : FK_Data_4;
diff --git a/include/llvm/MC/MCRegisterInfo.h b/include/llvm/MC/MCRegisterInfo.h
index 6f314aa..ec21fba 100644
--- a/include/llvm/MC/MCRegisterInfo.h
+++ b/include/llvm/MC/MCRegisterInfo.h
@@ -17,6 +17,7 @@
#define LLVM_MC_MCREGISTERINFO_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/ErrorHandling.h"
#include <cassert>
namespace llvm {
@@ -273,8 +274,7 @@ public:
const DenseMap<unsigned, unsigned> &M = isEH ? EHDwarf2LRegs : Dwarf2LRegs;
const DenseMap<unsigned, unsigned>::const_iterator I = M.find(RegNum);
if (I == M.end()) {
- assert(0 && "Invalid RegNum");
- return -1;
+ llvm_unreachable("Invalid RegNum");
}
return I->second;
}
diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h
index dd291f6..c5221af 100644
--- a/include/llvm/Support/CommandLine.h
+++ b/include/llvm/Support/CommandLine.h
@@ -337,7 +337,7 @@ struct OptionValueBase : public GenericOptionValue {
bool hasValue() const { return false; }
- const DataType &getValue() const { assert(false && "no default value"); }
+ const DataType &getValue() const { llvm_unreachable("no default value"); }
// Some options may take their value from a different data type.
template<class DT>
diff --git a/include/llvm/Support/Recycler.h b/include/llvm/Support/Recycler.h
index d8f8c78..fa6e189 100644
--- a/include/llvm/Support/Recycler.h
+++ b/include/llvm/Support/Recycler.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/ilist.h"
#include "llvm/Support/AlignOf.h"
+#include "llvm/Support/ErrorHandling.h"
#include <cassert>
namespace llvm {
@@ -52,7 +53,7 @@ struct ilist_traits<RecyclerStruct> :
static void noteHead(RecyclerStruct*, RecyclerStruct*) {}
static void deleteNode(RecyclerStruct *) {
- assert(0 && "Recycler's ilist_traits shouldn't see a deleteNode call!");
+ llvm_unreachable("Recycler's ilist_traits shouldn't see a deleteNode call!");
}
};
diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h
index 02ba21f..f51af28 100644
--- a/include/llvm/TableGen/Record.h
+++ b/include/llvm/TableGen/Record.h
@@ -20,6 +20,7 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <map>
@@ -671,8 +672,7 @@ public:
///
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const {
- assert(0 && "Illegal bit reference off int");
- return 0;
+ llvm_unreachable("Illegal bit reference off int");
}
/// resolveListElementReference - This method is used to implement
@@ -680,8 +680,7 @@ public:
/// now, we return the resolved value, otherwise we return null.
virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
unsigned Elt) const {
- assert(0 && "Illegal element reference off int");
- return 0;
+ llvm_unreachable("Illegal element reference off int");
}
};
@@ -716,8 +715,7 @@ public:
///
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const {
- assert(0 && "Illegal bit reference off string");
- return 0;
+ llvm_unreachable("Illegal bit reference off string");
}
/// resolveListElementReference - This method is used to implement
@@ -725,8 +723,7 @@ public:
/// now, we return the resolved value, otherwise we return null.
virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
unsigned Elt) const {
- assert(0 && "Illegal element reference off string");
- return 0;
+ llvm_unreachable("Illegal element reference off string");
}
};
@@ -786,8 +783,7 @@ public:
///
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const {
- assert(0 && "Illegal bit reference off list");
- return 0;
+ llvm_unreachable("Illegal bit reference off list");
}
/// resolveListElementReference - This method is used to implement
@@ -1132,8 +1128,7 @@ public:
///
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const {
- assert(0 && "Illegal bit reference off def");
- return 0;
+ llvm_unreachable("Illegal bit reference off def");
}
/// resolveListElementReference - This method is used to implement
@@ -1141,8 +1136,7 @@ public:
/// now, we return the resolved value, otherwise we return null.
virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
unsigned Elt) const {
- assert(0 && "Illegal element reference off def");
- return 0;
+ llvm_unreachable("Illegal element reference off def");
}
};
@@ -1251,14 +1245,12 @@ public:
virtual Init *resolveBitReference(Record &R, const RecordVal *RV,
unsigned Bit) const {
- assert(0 && "Illegal bit reference off dag");
- return 0;
+ llvm_unreachable("Illegal bit reference off dag");
}
virtual Init *resolveListElementReference(Record &R, const RecordVal *RV,
unsigned Elt) const {
- assert(0 && "Illegal element reference off dag");
- return 0;
+ llvm_unreachable("Illegal element reference off dag");
}
};
@@ -1416,7 +1408,7 @@ public:
Values.erase(Values.begin()+i);
return;
}
- assert(0 && "Cannot remove an entry that does not exist!");
+ llvm_unreachable("Cannot remove an entry that does not exist!");
}
void removeValue(StringRef Name) {
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h
index fb902d4..d1e380c 100644
--- a/include/llvm/Target/TargetInstrInfo.h
+++ b/include/llvm/Target/TargetInstrInfo.h
@@ -279,8 +279,7 @@ public:
/// This is only invoked in cases where AnalyzeBranch returns success. It
/// returns the number of instructions that were removed.
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const {
- assert(0 && "Target didn't implement TargetInstrInfo::RemoveBranch!");
- return 0;
+ llvm_unreachable("Target didn't implement TargetInstrInfo::RemoveBranch!");
}
/// InsertBranch - Insert branch code into the end of the specified
@@ -297,8 +296,7 @@ public:
MachineBasicBlock *FBB,
const SmallVectorImpl<MachineOperand> &Cond,
DebugLoc DL) const {
- assert(0 && "Target didn't implement TargetInstrInfo::InsertBranch!");
- return 0;
+ llvm_unreachable("Target didn't implement TargetInstrInfo::InsertBranch!");
}
/// ReplaceTailWithBranchTo - Delete the instruction OldInst and everything
@@ -375,7 +373,7 @@ public:
MachineBasicBlock::iterator MI, DebugLoc DL,
unsigned DestReg, unsigned SrcReg,
bool KillSrc) const {
- assert(0 && "Target didn't implement TargetInstrInfo::copyPhysReg!");
+ llvm_unreachable("Target didn't implement TargetInstrInfo::copyPhysReg!");
}
/// storeRegToStackSlot - Store the specified register of the given register
@@ -388,7 +386,8 @@ public:
unsigned SrcReg, bool isKill, int FrameIndex,
const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const {
- assert(0 && "Target didn't implement TargetInstrInfo::storeRegToStackSlot!");
+ llvm_unreachable("Target didn't implement "
+ "TargetInstrInfo::storeRegToStackSlot!");
}
/// loadRegFromStackSlot - Load the specified register of the given register
@@ -400,7 +399,8 @@ public:
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const {
- assert(0 && "Target didn't implement TargetInstrInfo::loadRegFromStackSlot!");
+ llvm_unreachable("Target didn't implement "
+ "TargetInstrInfo::loadRegFromStackSlot!");
}
/// expandPostRAPseudo - This function is called for all pseudo instructions
diff --git a/include/llvm/Target/TargetJITInfo.h b/include/llvm/Target/TargetJITInfo.h
index 5500cbf..80b78f8 100644
--- a/include/llvm/Target/TargetJITInfo.h
+++ b/include/llvm/Target/TargetJITInfo.h
@@ -46,8 +46,8 @@ namespace llvm {
/// ptr.
virtual void *emitGlobalValueIndirectSym(const GlobalValue* GV, void *ptr,
JITCodeEmitter &JCE) {
- assert(0 && "This target doesn't implement emitGlobalValueIndirectSym!");
- return 0;
+ llvm_unreachable("This target doesn't implement "
+ "emitGlobalValueIndirectSym!");
}
/// Records the required size and alignment for a call stub in bytes.
@@ -67,15 +67,13 @@ namespace llvm {
/// aligned from the address the JCE was set up to emit at.
virtual void *emitFunctionStub(const Function* F, void *Target,
JITCodeEmitter &JCE) {
- assert(0 && "This target doesn't implement emitFunctionStub!");
- return 0;
+ llvm_unreachable("This target doesn't implement emitFunctionStub!");
}
/// getPICJumpTableEntry - Returns the value of the jumptable entry for the
/// specific basic block.
virtual uintptr_t getPICJumpTableEntry(uintptr_t BB, uintptr_t JTBase) {
- assert(0 && "This target doesn't implement getPICJumpTableEntry!");
- return 0;
+ llvm_unreachable("This target doesn't implement getPICJumpTableEntry!");
}
/// LazyResolverFn - This typedef is used to represent the function that
@@ -96,8 +94,7 @@ namespace llvm {
/// function, and giving the JIT the target function used to do the lazy
/// resolving.
virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn) {
- assert(0 && "Not implemented for this target!");
- return 0;
+ llvm_unreachable("Not implemented for this target!");
}
/// relocate - Before the JIT can run a block of code that has been emitted,
@@ -113,8 +110,7 @@ namespace llvm {
/// handling thread local variables. This method returns a value only
/// meaningful to the target.
virtual char* allocateThreadLocalMemory(size_t size) {
- assert(0 && "This target does not implement thread local storage!");
- return 0;
+ llvm_unreachable("This target does not implement thread local storage!");
}
/// needsGOT - Allows a target to specify that it would like the
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h
index d66341a..9a62130 100644
--- a/include/llvm/Target/TargetLowering.h
+++ b/include/llvm/Target/TargetLowering.h
@@ -294,8 +294,7 @@ public:
VT = getTypeToTransformTo(Context, VT);
break;
default:
- assert(false && "Type is not legal nor is it to be expanded!");
- return VT;
+ llvm_unreachable("Type is not legal nor is it to be expanded!");
}
}
}
@@ -566,8 +565,7 @@ public:
if (VT.isInteger()) {
return getRegisterType(Context, getTypeToTransformTo(Context, VT));
}
- assert(0 && "Unsupported extended type!");
- return EVT(MVT::Other); // Not reached
+ llvm_unreachable("Unsupported extended type!");
}
/// getNumRegisters - Return the number of registers that this ValueType will
@@ -592,8 +590,7 @@ public:
unsigned RegWidth = getRegisterType(Context, VT).getSizeInBits();
return (BitWidth + RegWidth - 1) / RegWidth;
}
- assert(0 && "Unsupported extended type!");
- return 0; // Not reached
+ llvm_unreachable("Unsupported extended type!");
}
/// ShouldShrinkFPConstant - If true, then instruction selection should
@@ -784,8 +781,7 @@ public:
LowerCustomJumpTableEntry(const MachineJumpTableInfo * /*MJTI*/,
const MachineBasicBlock * /*MBB*/, unsigned /*uid*/,
MCContext &/*Ctx*/) const {
- assert(0 && "Need to implement this hook if target has custom JTIs");
- return 0;
+ llvm_unreachable("Need to implement this hook if target has custom JTIs");
}
/// getPICJumpTableRelocaBase - Returns relocation base for the given PIC
@@ -1210,8 +1206,7 @@ public:
const SmallVectorImpl<ISD::InputArg> &/*Ins*/,
DebugLoc /*dl*/, SelectionDAG &/*DAG*/,
SmallVectorImpl<SDValue> &/*InVals*/) const {
- assert(0 && "Not Implemented");
- return SDValue(); // this is here to silence compiler errors
+ llvm_unreachable("Not Implemented");
}
/// LowerCallTo - This function lowers an abstract call to a function into an
@@ -1256,8 +1251,7 @@ public:
const SmallVectorImpl<ISD::InputArg> &/*Ins*/,
DebugLoc /*dl*/, SelectionDAG &/*DAG*/,
SmallVectorImpl<SDValue> &/*InVals*/) const {
- assert(0 && "Not Implemented");
- return SDValue(); // this is here to silence compiler errors
+ llvm_unreachable("Not Implemented");
}
/// HandleByVal - Target-specific cleanup for formal ByVal parameters.
@@ -1287,8 +1281,7 @@ public:
const SmallVectorImpl<ISD::OutputArg> &/*Outs*/,
const SmallVectorImpl<SDValue> &/*OutVals*/,
DebugLoc /*dl*/, SelectionDAG &/*DAG*/) const {
- assert(0 && "Not Implemented");
- return SDValue(); // this is here to silence compiler errors
+ llvm_unreachable("Not Implemented");
}
/// isUsedByReturnOnly - Return true if result of the specified node is used
@@ -1353,7 +1346,7 @@ public:
virtual void ReplaceNodeResults(SDNode * /*N*/,
SmallVectorImpl<SDValue> &/*Results*/,
SelectionDAG &/*DAG*/) const {
- assert(0 && "ReplaceNodeResults not implemented for this target!");
+ llvm_unreachable("ReplaceNodeResults not implemented for this target!");
}
/// getTargetNodeName() - This method returns the name of a target specific
@@ -1939,9 +1932,6 @@ private:
// Vectors with illegal element types are expanded.
EVT NVT = EVT::getVectorVT(Context, EltVT, VT.getVectorNumElements() / 2);
return LegalizeKind(TypeSplitVector, NVT);
-
- assert(false && "Unable to handle this kind of vector type");
- return LegalizeKind(TypeLegal, VT);
}
std::vector<std::pair<EVT, TargetRegisterClass*> > AvailableRegClasses;
diff --git a/include/llvm/Target/TargetRegisterInfo.h b/include/llvm/Target/TargetRegisterInfo.h
index 711129f..449f3d1 100644
--- a/include/llvm/Target/TargetRegisterInfo.h
+++ b/include/llvm/Target/TargetRegisterInfo.h
@@ -495,8 +495,7 @@ public:
/// values. If a target supports multiple different pointer register classes,
/// kind specifies which one is indicated.
virtual const TargetRegisterClass *getPointerRegClass(unsigned Kind=0) const {
- assert(0 && "Target didn't implement getPointerRegClass!");
- return 0; // Must return a value in order to compile with VS 2005
+ llvm_unreachable("Target didn't implement getPointerRegClass!");
}
/// getCrossCopyRegClass - Returns a legal register class to copy a register
@@ -633,22 +632,22 @@ public:
virtual void materializeFrameBaseRegister(MachineBasicBlock *MBB,
unsigned BaseReg, int FrameIdx,
int64_t Offset) const {
- assert(0 && "materializeFrameBaseRegister does not exist on this target");
+ llvm_unreachable("materializeFrameBaseRegister does not exist on this "
+ "target");
}
/// resolveFrameIndex - Resolve a frame index operand of an instruction
/// to reference the indicated base register plus offset instead.
virtual void resolveFrameIndex(MachineBasicBlock::iterator I,
unsigned BaseReg, int64_t Offset) const {
- assert(0 && "resolveFrameIndex does not exist on this target");
+ llvm_unreachable("resolveFrameIndex does not exist on this target");
}
/// isFrameOffsetLegal - Determine whether a given offset immediate is
/// encodable to resolve a frame index.
virtual bool isFrameOffsetLegal(const MachineInstr *MI,
int64_t Offset) const {
- assert(0 && "isFrameOffsetLegal does not exist on this target");
- return false; // Must return a value in order to compile with VS 2005
+ llvm_unreachable("isFrameOffsetLegal does not exist on this target");
}
/// eliminateCallFramePseudoInstr - This method is called during prolog/epilog
@@ -662,7 +661,8 @@ public:
eliminateCallFramePseudoInstr(MachineFunction &MF,
MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI) const {
- assert(0 && "Call Frame Pseudo Instructions do not exist on this target!");
+ llvm_unreachable("Call Frame Pseudo Instructions do not exist on this "
+ "target!");
}
diff --git a/include/llvm/User.h b/include/llvm/User.h
index d3f4f21..c52f32f 100644
--- a/include/llvm/User.h
+++ b/include/llvm/User.h
@@ -19,6 +19,7 @@
#ifndef LLVM_USER_H
#define LLVM_USER_H
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Value.h"
namespace llvm {
@@ -65,11 +66,11 @@ public:
void operator delete(void *Usr);
/// placement delete - required by std, but never called.
void operator delete(void*, unsigned) {
- assert(0 && "Constructor throws?");
+ llvm_unreachable("Constructor throws?");
}
/// placement delete - required by std, but never called.
void operator delete(void*, unsigned, bool) {
- assert(0 && "Constructor throws?");
+ llvm_unreachable("Constructor throws?");
}
protected:
template <int Idx, typename U> static Use &OpFrom(const U *that) {
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index bffe859..a2f3b3f 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -117,8 +117,7 @@ Constant *Constant::getNullValue(Type *Ty) {
return ConstantAggregateZero::get(Ty);
default:
// Function, Label, or Opaque type?
- assert(0 && "Cannot create a null constant of that type!");
- return 0;
+ llvm_unreachable("Cannot create a null constant of that type!");
}
}
@@ -2285,7 +2284,7 @@ uint64_t ConstantDataSequential::getElementAsInteger(unsigned Elt) const {
// The data is stored in host byte order, make sure to cast back to the right
// type to load with the right endianness.
switch (getElementType()->getIntegerBitWidth()) {
- default: assert(0 && "Invalid bitwidth for CDS");
+ default: llvm_unreachable("Invalid bitwidth for CDS");
case 8: return *(uint8_t*)EltPtr;
case 16: return *(uint16_t*)EltPtr;
case 32: return *(uint32_t*)EltPtr;
@@ -2300,7 +2299,7 @@ APFloat ConstantDataSequential::getElementAsAPFloat(unsigned Elt) const {
switch (getElementType()->getTypeID()) {
default:
- assert(0 && "Accessor can only be used when element is float/double!");
+ llvm_unreachable("Accessor can only be used when element is float/double!");
case Type::FloatTyID: return APFloat(*(float*)EltPtr);
case Type::DoubleTyID: return APFloat(*(double*)EltPtr);
}
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index c376546..e86d805 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -133,8 +133,7 @@ LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M) {
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty) {
switch (unwrap(Ty)->getTypeID()) {
- default:
- assert(false && "Unhandled TypeID.");
+ default: llvm_unreachable("Unhandled TypeID.");
case Type::VoidTyID:
return LLVMVoidTypeKind;
case Type::HalfTyID:
@@ -680,8 +679,7 @@ LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size) {
static LLVMOpcode map_to_llvmopcode(int opcode)
{
switch (opcode) {
- default:
- assert(0 && "Unhandled Opcode.");
+ default: llvm_unreachable("Unhandled Opcode.");
#define HANDLE_INST(num, opc, clas) case num: return LLVM##opc;
#include "llvm/Instruction.def"
#undef HANDLE_INST
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index c0e6844..74cbfc4 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -1410,8 +1410,7 @@ unsigned GetElementPtrInst::getAddressSpace(Value *Ptr) {
if (PointerType *PTy = dyn_cast<PointerType>(Ty))
return PTy->getAddressSpace();
- assert(false && "Invalid GEP pointer type");
- return 0;
+ llvm_unreachable("Invalid GEP pointer type");
}
/// hasAllZeroIndices - Return true if all of the indices of this GEP are
@@ -2079,8 +2078,7 @@ bool CastInst::isNoopCast(Instruction::CastOps Opcode,
Type *DestTy,
Type *IntPtrTy) {
switch (Opcode) {
- default:
- assert(0 && "Invalid CastOp");
+ default: llvm_unreachable("Invalid CastOp");
case Instruction::Trunc:
case Instruction::ZExt:
case Instruction::SExt:
@@ -2273,11 +2271,9 @@ unsigned CastInst::isEliminableCastPair(
case 99:
// cast combination can't happen (error in input). This is for all cases
// where the MidTy is not the same for the two cast instructions.
- assert(0 && "Invalid Cast Combination");
- return 0;
+ llvm_unreachable("Invalid Cast Combination");
default:
- assert(0 && "Error in CastResults table!!!");
- return 0;
+ llvm_unreachable("Error in CastResults table!!!");
}
}
@@ -2298,9 +2294,7 @@ CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
case PtrToInt: return new PtrToIntInst (S, Ty, Name, InsertBefore);
case IntToPtr: return new IntToPtrInst (S, Ty, Name, InsertBefore);
case BitCast: return new BitCastInst (S, Ty, Name, InsertBefore);
- default:
- assert(0 && "Invalid opcode provided");
- return 0;
+ default: llvm_unreachable("Invalid opcode provided");
}
}
@@ -2321,9 +2315,7 @@ CastInst *CastInst::Create(Instruction::CastOps op, Value *S, Type *Ty,
case PtrToInt: return new PtrToIntInst (S, Ty, Name, InsertAtEnd);
case IntToPtr: return new IntToPtrInst (S, Ty, Name, InsertAtEnd);
case BitCast: return new BitCastInst (S, Ty, Name, InsertAtEnd);
- default:
- assert(0 && "Invalid opcode provided");
- return 0;
+ default: llvm_unreachable("Invalid opcode provided");
}
}
@@ -2606,17 +2598,17 @@ CastInst::getCastOpcode(
} else if (SrcTy->isIntegerTy()) {
return IntToPtr; // int -> ptr
} else {
- assert(0 && "Casting pointer to other than pointer or int");
+ llvm_unreachable("Casting pointer to other than pointer or int");
}
} else if (DestTy->isX86_MMXTy()) {
if (SrcTy->isVectorTy()) {
assert(DestBits == SrcBits && "Casting vector of wrong width to X86_MMX");
return BitCast; // 64-bit vector to MMX
} else {
- assert(0 && "Illegal cast to X86_MMX");
+ llvm_unreachable("Illegal cast to X86_MMX");
}
} else {
- assert(0 && "Casting to type that is not first-class");
+ llvm_unreachable("Casting to type that is not first-class");
}
// If we fall through to here we probably hit an assertion cast above
@@ -2938,7 +2930,7 @@ bool CmpInst::isEquality() const {
CmpInst::Predicate CmpInst::getInversePredicate(Predicate pred) {
switch (pred) {
- default: assert(0 && "Unknown cmp predicate!");
+ default: llvm_unreachable("Unknown cmp predicate!");
case ICMP_EQ: return ICMP_NE;
case ICMP_NE: return ICMP_EQ;
case ICMP_UGT: return ICMP_ULE;
@@ -2971,7 +2963,7 @@ CmpInst::Predicate CmpInst::getInversePredicate(Predicate pred) {
ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) {
switch (pred) {
- default: assert(0 && "Unknown icmp predicate!");
+ default: llvm_unreachable("Unknown icmp predicate!");
case ICMP_EQ: case ICMP_NE:
case ICMP_SGT: case ICMP_SLT: case ICMP_SGE: case ICMP_SLE:
return pred;
@@ -2984,7 +2976,7 @@ ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) {
ICmpInst::Predicate ICmpInst::getUnsignedPredicate(Predicate pred) {
switch (pred) {
- default: assert(0 && "Unknown icmp predicate!");
+ default: llvm_unreachable("Unknown icmp predicate!");
case ICMP_EQ: case ICMP_NE:
case ICMP_UGT: case ICMP_ULT: case ICMP_UGE: case ICMP_ULE:
return pred;
@@ -3060,7 +3052,7 @@ ICmpInst::makeConstantRange(Predicate pred, const APInt &C) {
CmpInst::Predicate CmpInst::getSwappedPredicate(Predicate pred) {
switch (pred) {
- default: assert(0 && "Unknown cmp predicate!");
+ default: llvm_unreachable("Unknown cmp predicate!");
case ICMP_EQ: case ICMP_NE:
return pred;
case ICMP_SGT: return ICMP_SLT;
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index dd27345..773862d 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -1228,8 +1228,7 @@ void PMDataManager::addLowerLevelRequiredPass(Pass *P, Pass *RequiredPass) {
}
Pass *PMDataManager::getOnTheFlyPass(Pass *P, AnalysisID PI, Function &F) {
- assert(0 && "Unable to find on the fly pass");
- return NULL;
+ llvm_unreachable("Unable to find on the fly pass");
}
// Destructor
diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp
index 33a6ecc..9a8e185 100644
--- a/lib/VMCore/ValueTypes.cpp
+++ b/lib/VMCore/ValueTypes.cpp
@@ -87,8 +87,7 @@ unsigned EVT::getExtendedSizeInBits() const {
return ITy->getBitWidth();
if (VectorType *VTy = dyn_cast<VectorType>(LLVMTy))
return VTy->getBitWidth();
- assert(false && "Unrecognized extended type!");
- return 0; // Suppress warnings.
+ llvm_unreachable("Unrecognized extended type!");
}
/// getEVTString - This function returns value type as a string, e.g. "i32".