diff options
author | Torok Edwin <edwintorok@gmail.com> | 2009-07-11 20:10:48 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2009-07-11 20:10:48 +0000 |
commit | c25e7581b9b8088910da31702d4ca21c4734c6d7 (patch) | |
tree | e4bb95c96a33fda5d5204f2c9d1b906084760415 /lib/VMCore/ConstantFold.cpp | |
parent | d51ffcf303070b0a5aea7f365b85f6f969c384cb (diff) |
assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index e019e6c29c..3919643c00 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -26,6 +26,7 @@ #include "llvm/GlobalAlias.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MathExtras.h" @@ -306,7 +307,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, break; } - assert(0 && "Failed to cast constant expression"); + LLVM_UNREACHABLE("Failed to cast constant expression"); return 0; } @@ -1304,7 +1305,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, APInt V1 = cast<ConstantInt>(C1)->getValue(); APInt V2 = cast<ConstantInt>(C2)->getValue(); switch (pred) { - default: assert(0 && "Invalid ICmp Predicate"); return 0; + default: LLVM_UNREACHABLE("Invalid ICmp Predicate"); return 0; case ICmpInst::ICMP_EQ: return ConstantInt::get(Type::Int1Ty, V1 == V2); case ICmpInst::ICMP_NE: return ConstantInt::get(Type::Int1Ty, V1 != V2); case ICmpInst::ICMP_SLT:return ConstantInt::get(Type::Int1Ty, V1.slt(V2)); @@ -1321,7 +1322,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, APFloat C2V = cast<ConstantFP>(C2)->getValueAPF(); APFloat::cmpResult R = C1V.compare(C2V); switch (pred) { - default: assert(0 && "Invalid FCmp Predicate"); return 0; + default: LLVM_UNREACHABLE("Invalid FCmp Predicate"); return 0; case FCmpInst::FCMP_FALSE: return ConstantInt::getFalse(); case FCmpInst::FCMP_TRUE: return ConstantInt::getTrue(); case FCmpInst::FCMP_UNO: @@ -1377,7 +1378,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, if (C1->getType()->isFloatingPoint()) { int Result = -1; // -1 = unknown, 0 = known false, 1 = known true. switch (evaluateFCmpRelation(C1, C2)) { - default: assert(0 && "Unknown relation!"); + default: LLVM_UNREACHABLE("Unknown relation!"); case FCmpInst::FCMP_UNO: case FCmpInst::FCMP_ORD: case FCmpInst::FCMP_UEQ: @@ -1436,7 +1437,7 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, // Evaluate the relation between the two constants, per the predicate. int Result = -1; // -1 = unknown, 0 = known false, 1 = known true. switch (evaluateICmpRelation(C1, C2, CmpInst::isSigned(pred))) { - default: assert(0 && "Unknown relational!"); + default: LLVM_UNREACHABLE("Unknown relational!"); case ICmpInst::BAD_ICMP_PREDICATE: break; // Couldn't determine anything about these constants. case ICmpInst::ICMP_EQ: // We know the constants are equal! |