[llvm-commits] [llvm] r149849 - in /llvm/trunk: include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/CodeGen/PBQP/ include/llvm/ExecutionEngine/ include/llvm/MC/ include/llvm/Support/ inc

David Blaikie dblaikie at gmail.com
Sun Feb 5 22:32:45 PST 2012


On Sun, Feb 5, 2012 at 2:14 PM, Craig Topper <craig.topper at gmail.com> wrote:
> Author: ctopper
> Date: Sun Feb  5 16:14:15 2012
> New Revision: 149849
>
> URL: http://llvm.org/viewvc/llvm-project?rev=149849&view=rev
> Log:
> Convert assert(0) to llvm_unreachable
>
> Modified:
>    llvm/trunk/include/llvm/ADT/BitVector.h
>    llvm/trunk/include/llvm/ADT/ImmutableSet.h
>    llvm/trunk/include/llvm/ADT/SmallBitVector.h
>    llvm/trunk/include/llvm/ADT/SparseBitVector.h
>    llvm/trunk/include/llvm/ADT/Trie.h
>    llvm/trunk/include/llvm/ADT/Twine.h
>    llvm/trunk/include/llvm/Analysis/IntervalIterator.h
>    llvm/trunk/include/llvm/Analysis/ProfileInfo.h
>    llvm/trunk/include/llvm/Bitcode/BitCodes.h
>    llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
>    llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
>    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
>    llvm/trunk/include/llvm/CodeGen/PBQP/HeuristicBase.h
>    llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
>    llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
>    llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
>    llvm/trunk/include/llvm/CodeGen/ValueTypes.h
>    llvm/trunk/include/llvm/Constant.h
>    llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
>    llvm/trunk/include/llvm/MC/MCAsmBackend.h
>    llvm/trunk/include/llvm/MC/MCFixup.h
>    llvm/trunk/include/llvm/MC/MCRegisterInfo.h
>    llvm/trunk/include/llvm/Support/CommandLine.h
>    llvm/trunk/include/llvm/Support/Recycler.h
>    llvm/trunk/include/llvm/TableGen/Record.h
>    llvm/trunk/include/llvm/Target/TargetInstrInfo.h
>    llvm/trunk/include/llvm/Target/TargetJITInfo.h
>    llvm/trunk/include/llvm/Target/TargetLowering.h
>    llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
>    llvm/trunk/include/llvm/User.h
>    llvm/trunk/lib/VMCore/Constants.cpp
>    llvm/trunk/lib/VMCore/Core.cpp
>    llvm/trunk/lib/VMCore/Instructions.cpp
>    llvm/trunk/lib/VMCore/PassManager.cpp
>    llvm/trunk/lib/VMCore/ValueTypes.cpp
>
> Modified: llvm/trunk/include/llvm/ADT/BitVector.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/BitVector.h (original)
> +++ llvm/trunk/include/llvm/ADT/BitVector.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>       else if (sizeof(BitWord) == 8)
>         NumBits += CountPopulation_64(Bits[i]);
>       else
> -        assert(0 && "Unsupported!");
> +        llvm_unreachable("Unsupported!");
>     return NumBits;
>   }
>
> @@ -146,10 +146,9 @@
>       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 @@
>     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 @@
>       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;
>   }
>
> Modified: llvm/trunk/include/llvm/ADT/ImmutableSet.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableSet.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/ImmutableSet.h (original)
> +++ llvm/trunk/include/llvm/ADT/ImmutableSet.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>         stack.back() |= VisitedRight;
>         break;
>       default:
> -        assert(false && "Unreachable.");
> +        llvm_unreachable("Unreachable.");
>     }
>   }
>
> @@ -722,7 +723,7 @@
>         skipToParent();
>         break;
>       default:
> -        assert(false && "Unreachable.");
> +        llvm_unreachable("Unreachable.");
>     }
>     return *this;
>   }
> @@ -747,7 +748,7 @@
>           stack.push_back(reinterpret_cast<uintptr_t>(R) | VisitedRight);
>         break;
>       default:
> -        assert(false && "Unreachable.");
> +        llvm_unreachable("Unreachable.");
>     }
>     return *this;
>   }
>
> Modified: llvm/trunk/include/llvm/ADT/SmallBitVector.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallBitVector.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/SmallBitVector.h (original)
> +++ llvm/trunk/include/llvm/ADT/SmallBitVector.h Sun Feb  5 16:14:15 2012
> @@ -175,7 +175,7 @@
>         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 @@
>         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 @@
>         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);
>   }
>
> Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original)
> +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>       else if (sizeof(BitWord) == 8)
>         NumBits += CountPopulation_64(Bits[i]);
>       else
> -        assert(0 && "Unsupported!");
> +        llvm_unreachable("Unsupported!");
>     return NumBits;
>   }
>
> @@ -138,13 +138,11 @@
>       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 @@
>     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 @@
>       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;
>   }
>
> Modified: llvm/trunk/include/llvm/ADT/Trie.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Trie.h (original)
> +++ llvm/trunk/include/llvm/ADT/Trie.h Sun Feb  5 16:14:15 2012
> @@ -220,8 +220,7 @@
>         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 @@
>       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;
>
> Modified: llvm/trunk/include/llvm/ADT/Twine.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Twine.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Twine.h (original)
> +++ llvm/trunk/include/llvm/ADT/Twine.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>     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);
>
> Modified: llvm/trunk/include/llvm/Analysis/IntervalIterator.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IntervalIterator.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/IntervalIterator.h (original)
> +++ llvm/trunk/include/llvm/Analysis/IntervalIterator.h Sun Feb  5 16:14:15 2012
> @@ -101,14 +101,14 @@
>   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!");
>     }
>   }
>
>
> Modified: llvm/trunk/include/llvm/Analysis/ProfileInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ProfileInfo.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Analysis/ProfileInfo.h (original)
> +++ llvm/trunk/include/llvm/Analysis/ProfileInfo.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>
>     // 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.
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitCodes.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitCodes.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitCodes.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitCodes.h Sun Feb  5 16:14:15 2012
> @@ -140,8 +140,7 @@
>     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 @@
>     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!");
>   }
>
>  };
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Sun Feb  5 16:14:15 2012
> @@ -455,10 +455,10 @@
>   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;
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Sun Feb  5 16:14:15 2012
> @@ -275,7 +275,7 @@
>
>     // 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());
>
> Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   class MachineModuleInfo;
>   class MachineMove;
>   class MCAsmInfo;
> -  class MCInst;
>   class MCContext;
>   class MCSection;
>   class MCStreamer;
> @@ -49,8 +49,6 @@
>   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 @@
>
>     /// 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();
>
> Modified: llvm/trunk/include/llvm/CodeGen/PBQP/HeuristicBase.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/PBQP/HeuristicBase.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/PBQP/HeuristicBase.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/PBQP/HeuristicBase.h Sun Feb  5 16:14:15 2012
> @@ -157,7 +157,7 @@
>         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 @@
>     /// \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 @@
>     /// @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 @@
>     /// 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.
>
> Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Sun Feb  5 16:14:15 2012
> @@ -128,9 +128,8 @@
>                  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;

If you could keep trailing asserts like this as trailing (though feel
free to convert them from assert to llvm_unreachable) that would be
great. Adding a default to a fully-covered switch like this is
unhelpful as it suppresses -Wswitch (which warns when a
switch-over-enum is not fully covered) should a new element be added
to the enumeration.

Clang has a warning I recently added (-Wcovered-switch-default) that
catches this case & your changes have caused several violations of
this warning across LLVM.

Let me know if you'd prefer me to fix them up.

- David

>     }
>
>     bool operator!=(const SDep &Other) const {
>
> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Sun Feb  5 16:14:15 2012
> @@ -51,7 +51,7 @@
>   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 &);
>
> Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Sun Feb  5 16:14:15 2012
> @@ -240,8 +240,7 @@
>   /// 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 @@
>   /// 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,
>
> Modified: llvm/trunk/include/llvm/CodeGen/ValueTypes.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ValueTypes.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/ValueTypes.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/ValueTypes.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>     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 @@
>     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:
>
> Modified: llvm/trunk/include/llvm/Constant.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Constant.h (original)
> +++ llvm/trunk/include/llvm/Constant.h Sun Feb  5 16:14:15 2012
> @@ -105,7 +105,7 @@
>   /// 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 @@
>     // 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
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   /// 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
>
> Modified: llvm/trunk/include/llvm/MC/MCAsmBackend.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmBackend.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCAsmBackend.h (original)
> +++ llvm/trunk/include/llvm/MC/MCAsmBackend.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   /// 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
>
> Modified: llvm/trunk/include/llvm/MC/MCFixup.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCFixup.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCFixup.h (original)
> +++ llvm/trunk/include/llvm/MC/MCFixup.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   /// 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;
>
> Modified: llvm/trunk/include/llvm/MC/MCRegisterInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCRegisterInfo.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCRegisterInfo.h (original)
> +++ llvm/trunk/include/llvm/MC/MCRegisterInfo.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>     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;
>   }
>
> Modified: llvm/trunk/include/llvm/Support/CommandLine.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CommandLine.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/CommandLine.h (original)
> +++ llvm/trunk/include/llvm/Support/CommandLine.h Sun Feb  5 16:14:15 2012
> @@ -337,7 +337,7 @@
>
>   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>
>
> Modified: llvm/trunk/include/llvm/Support/Recycler.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Recycler.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Recycler.h (original)
> +++ llvm/trunk/include/llvm/Support/Recycler.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   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!");
>   }
>  };
>
>
> Modified: llvm/trunk/include/llvm/TableGen/Record.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/TableGen/Record.h (original)
> +++ llvm/trunk/include/llvm/TableGen/Record.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   ///
>   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 @@
>   /// 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 @@
>   ///
>   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 @@
>   /// 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 @@
>   ///
>   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 @@
>   ///
>   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 @@
>   /// 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 @@
>
>   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 @@
>         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) {
>
> Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Sun Feb  5 16:14:15 2012
> @@ -279,8 +279,7 @@
>   /// 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 @@
>                                 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 @@
>                            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 @@
>                                    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 @@
>                                     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
>
> Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Sun Feb  5 16:14:15 2012
> @@ -46,8 +46,8 @@
>     /// 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 @@
>     /// 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 @@
>     /// 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 @@
>     /// 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
>
> Modified: llvm/trunk/include/llvm/Target/TargetLowering.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetLowering.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetLowering.h Sun Feb  5 16:14:15 2012
> @@ -294,8 +294,7 @@
>         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 @@
>     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 @@
>       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 @@
>   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 @@
>                          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 @@
>               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 @@
>                 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 @@
>   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 @@
>     // 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;
>
> Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original)
> +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Sun Feb  5 16:14:15 2012
> @@ -495,8 +495,7 @@
>   /// 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 @@
>   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 @@
>   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!");
>   }
>
>
>
> Modified: llvm/trunk/include/llvm/User.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/User.h?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/User.h (original)
> +++ llvm/trunk/include/llvm/User.h Sun Feb  5 16:14:15 2012
> @@ -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 @@
>   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) {
>
> Modified: llvm/trunk/lib/VMCore/Constants.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Constants.cpp (original)
> +++ llvm/trunk/lib/VMCore/Constants.cpp Sun Feb  5 16:14:15 2012
> @@ -117,8 +117,7 @@
>     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 @@
>   // 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 @@
>
>   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);
>   }
>
> Modified: llvm/trunk/lib/VMCore/Core.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Core.cpp (original)
> +++ llvm/trunk/lib/VMCore/Core.cpp Sun Feb  5 16:14:15 2012
> @@ -133,8 +133,7 @@
>
>  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 @@
>  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
>
> Modified: llvm/trunk/lib/VMCore/Instructions.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
> +++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Feb  5 16:14:15 2012
> @@ -1410,8 +1410,7 @@
>   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 @@
>                           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 @@
>     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 @@
>     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 @@
>     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 @@
>     } 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 @@
>
>  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 @@
>
>  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::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 @@
>
>  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;
>
> Modified: llvm/trunk/lib/VMCore/PassManager.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/PassManager.cpp (original)
> +++ llvm/trunk/lib/VMCore/PassManager.cpp Sun Feb  5 16:14:15 2012
> @@ -1228,8 +1228,7 @@
>  }
>
>  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
>
> Modified: llvm/trunk/lib/VMCore/ValueTypes.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ValueTypes.cpp?rev=149849&r1=149848&r2=149849&view=diff
> ==============================================================================
> --- llvm/trunk/lib/VMCore/ValueTypes.cpp (original)
> +++ llvm/trunk/lib/VMCore/ValueTypes.cpp Sun Feb  5 16:14:15 2012
> @@ -87,8 +87,7 @@
>     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".
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list