[Transforms] Use asserts instead of ifs around llvm_unreachable. NFC

llvm-svn: 256405
This commit is contained in:
Craig Topper 2015-12-25 02:04:17 +00:00
parent 7f040bf658
commit 582d8ecf6a
1 changed files with 20 additions and 34 deletions

View File

@ -380,14 +380,10 @@ bool llvm::expandRemainder(BinaryOperator *Rem) {
IRBuilder<> Builder(Rem); IRBuilder<> Builder(Rem);
Type *RemTy = Rem->getType(); assert(!Rem->getType()->isVectorTy() && "Div over vectors not supported");
if (RemTy->isVectorTy()) assert((Rem->getType()->getIntegerBitWidth() == 32 ||
llvm_unreachable("Div over vectors not supported"); Rem->getType()->getIntegerBitWidth() == 64) &&
"Div of bitwidth other than 32 or 64 not supported");
unsigned RemTyBitWidth = RemTy->getIntegerBitWidth();
if (RemTyBitWidth != 32 && RemTyBitWidth != 64)
llvm_unreachable("Div of bitwidth other than 32 or 64 not supported");
// First prepare the sign if it's a signed remainder // First prepare the sign if it's a signed remainder
if (Rem->getOpcode() == Instruction::SRem) { if (Rem->getOpcode() == Instruction::SRem) {
@ -440,14 +436,10 @@ bool llvm::expandDivision(BinaryOperator *Div) {
IRBuilder<> Builder(Div); IRBuilder<> Builder(Div);
Type *DivTy = Div->getType(); assert(!Div->getType()->isVectorTy() && "Div over vectors not supported");
if (DivTy->isVectorTy()) assert((Div->getType()->getIntegerBitWidth() == 32 ||
llvm_unreachable("Div over vectors not supported"); Div->getType()->getIntegerBitWidth() == 64) &&
"Div of bitwidth other than 32 or 64 not supported");
unsigned DivTyBitWidth = DivTy->getIntegerBitWidth();
if (DivTyBitWidth != 32 && DivTyBitWidth != 64)
llvm_unreachable("Div of bitwidth other than 32 or 64 not supported");
// First prepare the sign if it's a signed division // First prepare the sign if it's a signed division
if (Div->getOpcode() == Instruction::SDiv) { if (Div->getOpcode() == Instruction::SDiv) {
@ -492,15 +484,14 @@ bool llvm::expandRemainderUpTo32Bits(BinaryOperator *Rem) {
"Trying to expand remainder from a non-remainder function"); "Trying to expand remainder from a non-remainder function");
Type *RemTy = Rem->getType(); Type *RemTy = Rem->getType();
if (RemTy->isVectorTy()) assert(!RemTy->isVectorTy() && "Div over vectors not supported");
llvm_unreachable("Div over vectors not supported");
unsigned RemTyBitWidth = RemTy->getIntegerBitWidth(); unsigned RemTyBitWidth = RemTy->getIntegerBitWidth();
if (RemTyBitWidth > 32) assert(RemTyBitWidth <= 32 &&
llvm_unreachable("Div of bitwidth greater than 32 not supported"); "Div of bitwidth greater than 32 not supported");
if (RemTyBitWidth == 32) if (RemTyBitWidth == 32)
return expandRemainder(Rem); return expandRemainder(Rem);
// If bitwidth smaller than 32 extend inputs, extend output and proceed // If bitwidth smaller than 32 extend inputs, extend output and proceed
@ -542,15 +533,13 @@ bool llvm::expandRemainderUpTo64Bits(BinaryOperator *Rem) {
"Trying to expand remainder from a non-remainder function"); "Trying to expand remainder from a non-remainder function");
Type *RemTy = Rem->getType(); Type *RemTy = Rem->getType();
if (RemTy->isVectorTy()) assert(!RemTy->isVectorTy() && "Div over vectors not supported");
llvm_unreachable("Div over vectors not supported");
unsigned RemTyBitWidth = RemTy->getIntegerBitWidth(); unsigned RemTyBitWidth = RemTy->getIntegerBitWidth();
if (RemTyBitWidth > 64) assert(RemTyBitWidth <= 64 && "Div of bitwidth greater than 64 not supported");
llvm_unreachable("Div of bitwidth greater than 64 not supported");
if (RemTyBitWidth == 64) if (RemTyBitWidth == 64)
return expandRemainder(Rem); return expandRemainder(Rem);
// If bitwidth smaller than 64 extend inputs, extend output and proceed // If bitwidth smaller than 64 extend inputs, extend output and proceed
@ -593,13 +582,11 @@ bool llvm::expandDivisionUpTo32Bits(BinaryOperator *Div) {
"Trying to expand division from a non-division function"); "Trying to expand division from a non-division function");
Type *DivTy = Div->getType(); Type *DivTy = Div->getType();
if (DivTy->isVectorTy()) assert(!DivTy->isVectorTy() && "Div over vectors not supported");
llvm_unreachable("Div over vectors not supported");
unsigned DivTyBitWidth = DivTy->getIntegerBitWidth(); unsigned DivTyBitWidth = DivTy->getIntegerBitWidth();
if (DivTyBitWidth > 32) assert(DivTyBitWidth <= 32 && "Div of bitwidth greater than 32 not supported");
llvm_unreachable("Div of bitwidth greater than 32 not supported");
if (DivTyBitWidth == 32) if (DivTyBitWidth == 32)
return expandDivision(Div); return expandDivision(Div);
@ -643,13 +630,12 @@ bool llvm::expandDivisionUpTo64Bits(BinaryOperator *Div) {
"Trying to expand division from a non-division function"); "Trying to expand division from a non-division function");
Type *DivTy = Div->getType(); Type *DivTy = Div->getType();
if (DivTy->isVectorTy()) assert(!DivTy->isVectorTy() && "Div over vectors not supported");
llvm_unreachable("Div over vectors not supported");
unsigned DivTyBitWidth = DivTy->getIntegerBitWidth(); unsigned DivTyBitWidth = DivTy->getIntegerBitWidth();
if (DivTyBitWidth > 64) assert(DivTyBitWidth <= 64 &&
llvm_unreachable("Div of bitwidth greater than 64 not supported"); "Div of bitwidth greater than 64 not supported");
if (DivTyBitWidth == 64) if (DivTyBitWidth == 64)
return expandDivision(Div); return expandDivision(Div);