Convert assert(0) to llvm_unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2012-02-07 05:05:23 +00:00
parent bc2198133a
commit 858143816d
30 changed files with 66 additions and 89 deletions

View File

@ -862,7 +862,7 @@ Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, Type *DestTy,
switch (Opcode) {
default: return 0;
case Instruction::ICmp:
case Instruction::FCmp: assert(0 && "Invalid for compares");
case Instruction::FCmp: llvm_unreachable("Invalid for compares");
case Instruction::Call:
if (Function *F = dyn_cast<Function>(Ops.back()))
if (canConstantFoldCallTo(F))
@ -1390,7 +1390,7 @@ llvm::ConstantFoldCall(Function *F, ArrayRef<Constant *> Operands,
APInt Res;
bool Overflow;
switch (F->getIntrinsicID()) {
default: assert(0 && "Invalid case");
default: llvm_unreachable("Invalid case");
case Intrinsic::sadd_with_overflow:
Res = Op1->getValue().sadd_ov(Op2->getValue(), Overflow);
break;

View File

@ -583,8 +583,7 @@ StringRef DIScope::getFilename() const {
return DIType(DbgNode).getFilename();
if (isFile())
return DIFile(DbgNode).getFilename();
assert(0 && "Invalid DIScope!");
return StringRef();
llvm_unreachable("Invalid DIScope!");
}
StringRef DIScope::getDirectory() const {
@ -604,8 +603,7 @@ StringRef DIScope::getDirectory() const {
return DIType(DbgNode).getDirectory();
if (isFile())
return DIFile(DbgNode).getDirectory();
assert(0 && "Invalid DIScope!");
return StringRef();
llvm_unreachable("Invalid DIScope!");
}
DIArray DICompileUnit::getEnumTypes() const {

View File

@ -1595,8 +1595,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
if (match(RHS, m_Zero())) {
bool LHSKnownNonNegative, LHSKnownNegative;
switch (Pred) {
default:
assert(false && "Unknown ICmp predicate!");
default: llvm_unreachable("Unknown ICmp predicate!");
case ICmpInst::ICMP_ULT:
return getFalse(ITy);
case ICmpInst::ICMP_UGE:
@ -1766,8 +1765,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
// there. Use this to work out the result of the comparison.
if (RExt != CI) {
switch (Pred) {
default:
assert(false && "Unknown ICmp predicate!");
default: llvm_unreachable("Unknown ICmp predicate!");
// LHS <u RHS.
case ICmpInst::ICMP_EQ:
case ICmpInst::ICMP_UGT:
@ -1826,8 +1824,7 @@ static Value *SimplifyICmpInst(unsigned Predicate, Value *LHS, Value *RHS,
// bits there. Use this to work out the result of the comparison.
if (RExt != CI) {
switch (Pred) {
default:
assert(false && "Unknown ICmp predicate!");
default: llvm_unreachable("Unknown ICmp predicate!");
case ICmpInst::ICMP_EQ:
return ConstantInt::getFalse(CI->getContext());
case ICmpInst::ICMP_NE:

View File

@ -2837,7 +2837,7 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
}
switch (ParseInstruction(Inst, BB, PFS)) {
default: assert(0 && "Unknown ParseInstruction result!");
default: llvm_unreachable("Unknown ParseInstruction result!");
case InstError: return true;
case InstNormal:
BB->getInstList().push_back(Inst);

View File

@ -1149,6 +1149,6 @@ void ExecutionEngineState::AddressMapConfig::onDelete(ExecutionEngineState *EES,
void ExecutionEngineState::AddressMapConfig::onRAUW(ExecutionEngineState *,
const GlobalValue *,
const GlobalValue *) {
assert(false && "The ExecutionEngine doesn't know how to handle a"
llvm_unreachable("The ExecutionEngine doesn't know how to handle a"
" RAUW on a value it has a global mapping for.");
}

View File

@ -706,9 +706,8 @@ void *JIT::getPointerToBasicBlock(BasicBlock *BB) {
if (I != getBasicBlockAddressMap(locked).end()) {
return I->second;
} else {
assert(0 && "JIT does not have BB address for address-of-label, was"
llvm_unreachable("JIT does not have BB address for address-of-label, was"
" it eliminated by optimizer?");
return 0;
}
}

View File

@ -76,7 +76,7 @@ namespace {
struct NoRAUWValueMapConfig : public ValueMapConfig<ValueTy> {
typedef JITResolverState *ExtraData;
static void onRAUW(JITResolverState *, Value *Old, Value *New) {
assert(false && "The JIT doesn't know how to handle a"
llvm_unreachable("The JIT doesn't know how to handle a"
" RAUW on a value it has emitted.");
}
};
@ -1162,7 +1162,7 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
break;
}
case MachineJumpTableInfo::EK_GPRel64BlockAddress:
assert(false &&
llvm_unreachable(
"JT Info emission not implemented for GPRel64BlockAddress yet.");
}
}

View File

@ -213,6 +213,5 @@ GenericValue MCJIT::runFunction(Function *F,
}
}
assert(0 && "Full-featured argument passing not supported yet!");
return GenericValue();
llvm_unreachable("Full-featured argument passing not supported yet!");
}

View File

@ -185,9 +185,7 @@ void RuntimeDyldELF::resolveX86_64Relocation(StringRef Name,
}
switch (RE.Type) {
default:
assert(0 && ("Relocation type not implemented yet!"));
break;
default: llvm_unreachable("Relocation type not implemented yet!");
case ELF::R_X86_64_64: {
uint8_t **Target = reinterpret_cast<uint8_t**>(TargetAddr);
*Target = Addr + RE.Addend;
@ -249,8 +247,7 @@ void RuntimeDyldELF::resolveX86Relocation(StringRef Name,
default:
// There are other relocation types, but it appears these are the
// only ones currently used by the LLVM ELF object writer
assert(0 && ("Relocation type not implemented yet!"));
break;
llvm_unreachable("Relocation type not implemented yet!");
}
}
@ -272,9 +269,7 @@ void RuntimeDyldELF::resolveRelocation(StringRef Name,
case Triple::arm:
resolveArmRelocation(Name, Addr, RE);
break;
default:
assert(0 && "Unsupported CPU type!");
break;
default: llvm_unreachable("Unsupported CPU type!");
}
}

View File

@ -26,7 +26,7 @@ resolveRelocation(uint8_t *Address, uint64_t Value, bool isPCRel,
unsigned Type, unsigned Size, int64_t Addend) {
// This just dispatches to the proper target specific routine.
switch (CPUType) {
default: assert(0 && "Unsupported CPU type!");
default: llvm_unreachable("Unsupported CPU type!");
case mach::CTM_x86_64:
return resolveX86_64Relocation((uintptr_t)Address, (uintptr_t)Value,
isPCRel, Type, Size, Addend);

View File

@ -267,7 +267,7 @@ Type *TypeMapTy::getImpl(Type *Ty) {
// Otherwise, rebuild a modified type.
switch (Ty->getTypeID()) {
default: assert(0 && "unknown derived type to remap");
default: llvm_unreachable("unknown derived type to remap");
case Type::ArrayTyID:
return *Entry = ArrayType::get(ElementTypes[0],
cast<ArrayType>(Ty)->getNumElements());

View File

@ -394,7 +394,7 @@ void MCAsmStreamer::EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
MCSymbolAttr Attribute) {
switch (Attribute) {
case MCSA_Invalid: assert(0 && "Invalid symbol attribute");
case MCSA_Invalid: llvm_unreachable("Invalid symbol attribute");
case MCSA_ELF_TypeFunction: /// .type _foo, STT_FUNC # aka @function
case MCSA_ELF_TypeIndFunction: /// .type _foo, STT_GNU_IFUNC
case MCSA_ELF_TypeObject: /// .type _foo, STT_OBJECT # aka @object
@ -406,7 +406,7 @@ void MCAsmStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
OS << "\t.type\t" << *Symbol << ','
<< ((MAI.getCommentString()[0] != '@') ? '@' : '%');
switch (Attribute) {
default: assert(0 && "Unknown ELF .type");
default: llvm_unreachable("Unknown ELF .type");
case MCSA_ELF_TypeFunction: OS << "function"; break;
case MCSA_ELF_TypeIndFunction: OS << "gnu_indirect_function"; break;
case MCSA_ELF_TypeObject: OS << "object"; break;

View File

@ -348,8 +348,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCAsmLayout &Layout,
return cast<MCDwarfCallFrameFragment>(F).getContents().size();
}
assert(0 && "invalid fragment kind");
return 0;
llvm_unreachable("invalid fragment kind");
}
void MCAsmLayout::LayoutFragment(MCFragment *F) {
@ -414,8 +413,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
// Otherwise, write out in multiples of the value size.
for (uint64_t i = 0; i != Count; ++i) {
switch (AF.getValueSize()) {
default:
assert(0 && "Invalid size!");
default: llvm_unreachable("Invalid size!");
case 1: OW->Write8 (uint8_t (AF.getValue())); break;
case 2: OW->Write16(uint16_t(AF.getValue())); break;
case 4: OW->Write32(uint32_t(AF.getValue())); break;
@ -439,8 +437,7 @@ static void WriteFragmentData(const MCAssembler &Asm, const MCAsmLayout &Layout,
for (uint64_t i = 0, e = FF.getSize() / FF.getValueSize(); i != e; ++i) {
switch (FF.getValueSize()) {
default:
assert(0 && "Invalid size!");
default: llvm_unreachable("Invalid size!");
case 1: OW->Write8 (uint8_t (FF.getValue())); break;
case 2: OW->Write16(uint16_t(FF.getValue())); break;
case 4: OW->Write32(uint32_t(FF.getValue())); break;
@ -496,8 +493,7 @@ void MCAssembler::writeSectionData(const MCSectionData *SD,
for (MCSectionData::const_iterator it = SD->begin(),
ie = SD->end(); it != ie; ++it) {
switch (it->getKind()) {
default:
assert(0 && "Invalid fragment in virtual section!");
default: llvm_unreachable("Invalid fragment in virtual section!");
case MCFragment::FT_Data: {
// Check that we aren't trying to write a non-zero contents (or fixups)
// into a virtual section. This is to support clients which use standard

View File

@ -23,7 +23,7 @@ int EDGetDisassembler(EDDisassemblerRef *disassembler,
EDAssemblySyntax_t syntax) {
EDDisassembler::AssemblySyntax Syntax;
switch (syntax) {
default: assert(0 && "Unknown assembly syntax!");
default: llvm_unreachable("Unknown assembly syntax!");
case kEDAssemblySyntaxX86Intel:
Syntax = EDDisassembler::kEDAssemblySyntaxX86Intel;
break;

View File

@ -765,8 +765,7 @@ static unsigned getSizeForEncoding(MCStreamer &streamer,
MCContext &context = streamer.getContext();
unsigned format = symbolEncoding & 0x0f;
switch (format) {
default:
assert(0 && "Unknown Encoding");
default: llvm_unreachable("Unknown Encoding");
case dwarf::DW_EH_PE_absptr:
case dwarf::DW_EH_PE_signed:
return context.getAsmInfo().getPointerSize();

View File

@ -60,24 +60,24 @@ public:
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol);
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute);
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment);
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitCOFFSymbolType(int Type) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EndCOFFSymbolDef() {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
@ -90,11 +90,11 @@ public:
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol,
uint64_t Size, unsigned ByteAlignment = 0) {
assert(0 && "ELF doesn't support this directive");
llvm_unreachable("ELF doesn't support this directive");
}
virtual void EmitBytes(StringRef Data, unsigned AddrSpace);
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0,
@ -180,7 +180,7 @@ void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
return;
}
assert(0 && "invalid assembler flag!");
llvm_unreachable("invalid assembler flag!");
}
void MCELFStreamer::EmitThumbFunc(MCSymbol *Func) {
@ -250,8 +250,7 @@ void MCELFStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
case MCSA_WeakDefAutoPrivate:
case MCSA_Invalid:
case MCSA_IndirectSymbol:
assert(0 && "Invalid symbol attribute for ELF!");
break;
llvm_unreachable("Invalid symbol attribute for ELF!");
case MCSA_ELF_TypeGnuUniqueObject:
// Ignore for now.

View File

@ -132,7 +132,7 @@ void MCExpr::print(raw_ostream &OS) const {
}
}
assert(0 && "Invalid expression kind!");
llvm_unreachable("Invalid expression kind!");
}
void MCExpr::dump() const {
@ -576,8 +576,7 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
}
}
assert(0 && "Invalid assembly expression kind!");
return false;
llvm_unreachable("Invalid assembly expression kind!");
}
const MCSection *MCExpr::FindAssociatedSection() const {
@ -618,6 +617,5 @@ const MCSection *MCExpr::FindAssociatedSection() const {
}
}
assert(0 && "Invalid assembly expression kind!");
return 0;
llvm_unreachable("Invalid assembly expression kind!");
}

View File

@ -10,6 +10,7 @@
#include "llvm/MC/MCInstPrinter.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@ -23,7 +24,7 @@ StringRef MCInstPrinter::getOpcodeName(unsigned Opcode) const {
}
void MCInstPrinter::printRegName(raw_ostream &OS, unsigned RegNo) const {
assert(0 && "Target should implement this");
llvm_unreachable("Target should implement this");
}
void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) {

View File

@ -53,23 +53,23 @@ public:
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment);
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol) {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EmitCOFFSymbolStorageClass(int StorageClass) {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EmitCOFFSymbolType(int Type) {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EndCOFFSymbolDef() {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
assert(0 && "macho doesn't support this directive");
llvm_unreachable("macho doesn't support this directive");
}
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol = 0,
unsigned Size = 0, unsigned ByteAlignment = 0);
@ -211,8 +211,7 @@ void MCMachOStreamer::EmitSymbolAttribute(MCSymbol *Symbol,
case MCSA_Protected:
case MCSA_Weak:
case MCSA_Local:
assert(0 && "Invalid symbol attribute for Mach-O!");
break;
llvm_unreachable("Invalid symbol attribute for Mach-O!");
case MCSA_Global:
SD.setExternal(true);

View File

@ -805,8 +805,7 @@ AsmParser::ApplyModifierToExpr(const MCExpr *E,
}
}
assert(0 && "Invalid expression kind!");
return 0;
llvm_unreachable("Invalid expression kind!");
}
/// ParseExpression - Parse an expression and return it.

View File

@ -600,7 +600,7 @@ void MCStreamer::EmitWin64EHEndProlog() {
}
void MCStreamer::EmitCOFFSecRel32(MCSymbol const *Symbol) {
assert(0 && "This file format doesn't support this directive");
llvm_unreachable("This file format doesn't support this directive");
}
void MCStreamer::EmitFnStart() {

View File

@ -55,7 +55,7 @@ ConstantRange ConstantRange::makeICmpRegion(unsigned Pred,
uint32_t W = CR.getBitWidth();
switch (Pred) {
default: assert(0 && "Invalid ICmp predicate to makeICmpRegion()");
default: llvm_unreachable("Invalid ICmp predicate to makeICmpRegion()");
case CmpInst::ICMP_EQ:
return CR;
case CmpInst::ICMP_NE:

View File

@ -459,8 +459,7 @@ std::string Triple::normalize(StringRef Str) {
bool Valid = false;
StringRef Comp = Components[Idx];
switch (Pos) {
default:
assert(false && "unexpected component type!");
default: llvm_unreachable("unexpected component type!");
case 0:
Arch = ParseArch(Comp);
Valid = Arch != UnknownArch;
@ -618,7 +617,7 @@ bool Triple::getMacOSXVersion(unsigned &Major, unsigned &Minor,
getOSVersion(Major, Minor, Micro);
switch (getOS()) {
default: assert(0 && "unexpected OS for Darwin triple");
default: llvm_unreachable("unexpected OS for Darwin triple");
case Darwin:
// Default to darwin8, i.e., MacOSX 10.4.
if (Major == 0)

View File

@ -942,7 +942,7 @@ Init *BinOpInit::Fold(Record *CurRec, MultiClass *CurMultiClass) const {
int64_t LHSv = LHSi->getValue(), RHSv = RHSi->getValue();
int64_t Result;
switch (getOpcode()) {
default: assert(0 && "Bad opcode!");
default: llvm_unreachable("Bad opcode!");
case SHL: Result = LHSv << RHSv; break;
case SRA: Result = LHSv >> RHSv; break;
case SRL: Result = (uint64_t)LHSv >> (uint64_t)RHSv; break;

View File

@ -729,7 +729,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
RecTy *Type = 0;
switch (Lex.getCode()) {
default: assert(0 && "Unhandled code!");
default: llvm_unreachable("Unhandled code!");
case tgtok::XCast:
Lex.Lex(); // eat the operation
Code = UnOpInit::CAST;
@ -845,7 +845,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
RecTy *Type = 0;
switch (OpTok) {
default: assert(0 && "Unhandled code!");
default: llvm_unreachable("Unhandled code!");
case tgtok::XConcat: Code = BinOpInit::CONCAT;Type = DagRecTy::get(); break;
case tgtok::XSRA: Code = BinOpInit::SRA; Type = IntRecTy::get(); break;
case tgtok::XSRL: Code = BinOpInit::SRL; Type = IntRecTy::get(); break;
@ -909,7 +909,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
tgtok::TokKind LexCode = Lex.getCode();
Lex.Lex(); // eat the operation
switch (LexCode) {
default: assert(0 && "Unhandled code!");
default: llvm_unreachable("Unhandled code!");
case tgtok::XIf:
Code = TernOpInit::IF;
break;
@ -954,7 +954,7 @@ Init *TGParser::ParseOperation(Record *CurRec) {
Lex.Lex(); // eat the ')'
switch (LexCode) {
default: assert(0 && "Unhandled code!");
default: llvm_unreachable("Unhandled code!");
case tgtok::XIf: {
// FIXME: The `!if' operator doesn't handle non-TypedInit well at
// all. This can be made much more robust.

View File

@ -110,7 +110,7 @@ static Value *getFCmpValue(bool isordered, unsigned code,
InstCombiner::BuilderTy *Builder) {
CmpInst::Predicate Pred;
switch (code) {
default: assert(0 && "Illegal FCmp code!");
default: llvm_unreachable("Illegal FCmp code!");
case 0: Pred = isordered ? FCmpInst::FCMP_ORD : FCmpInst::FCMP_UNO; break;
case 1: Pred = isordered ? FCmpInst::FCMP_OGT : FCmpInst::FCMP_UGT; break;
case 2: Pred = isordered ? FCmpInst::FCMP_OEQ : FCmpInst::FCMP_UEQ; break;

View File

@ -199,7 +199,7 @@ static Value *GetShiftedValue(Value *V, unsigned NumBits, bool isLeftShift,
IC.Worklist.Add(I);
switch (I->getOpcode()) {
default: assert(0 && "Inconsistency with CanEvaluateShifted");
default: llvm_unreachable("Inconsistency with CanEvaluateShifted");
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:

View File

@ -703,8 +703,7 @@ static uint64_t ValueForPoison(uint64_t PoisonByte, size_t ShadowRedzoneSize) {
if (ShadowRedzoneSize == 4)
return (PoisonByte << 24) + (PoisonByte << 16) +
(PoisonByte << 8) + (PoisonByte);
assert(0 && "ShadowRedzoneSize is either 1, 2 or 4");
return 0;
llvm_unreachable("ShadowRedzoneSize is either 1, 2 or 4");
}
static void PoisonShadowPartialRightRedzone(uint8_t *Shadow,

View File

@ -224,7 +224,7 @@ static bool isRemovable(Instruction *I) {
IntrinsicInst *II = cast<IntrinsicInst>(I);
switch (II->getIntrinsicID()) {
default: assert(0 && "doesn't pass 'hasMemoryWrite' predicate");
default: llvm_unreachable("doesn't pass 'hasMemoryWrite' predicate");
case Intrinsic::lifetime_end:
// Never remove dead lifetime_end's, e.g. because it is followed by a
// free.
@ -268,7 +268,7 @@ static Value *getStoredPointerOperand(Instruction *I) {
IntrinsicInst *II = cast<IntrinsicInst>(I);
switch (II->getIntrinsicID()) {
default: assert(false && "Unexpected intrinsic!");
default: llvm_unreachable("Unexpected intrinsic!");
case Intrinsic::init_trampoline:
return II->getArgOperand(0);
}

View File

@ -72,7 +72,7 @@ unsigned llvm::getICmpCode(const ICmpInst *ICI, bool InvertPred) {
Value *llvm::getICmpValue(bool Sign, unsigned Code, Value *LHS, Value *RHS,
CmpInst::Predicate &NewICmpPred) {
switch (Code) {
default: assert(0 && "Illegal ICmp code!");
default: llvm_unreachable("Illegal ICmp code!");
case 0: // False.
return ConstantInt::get(CmpInst::makeCmpResultType(LHS->getType()), 0);
case 1: NewICmpPred = Sign ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT; break;