[IRTranslator] Simplify error handling for translating constants. NFC.

We don't need to check whether the fallback path is enabled to return
false. Just do that all the time on error cases, the caller knows (or
at least should know!) how to handle the failing case.

llvm-svn: 297535
This commit is contained in:
Quentin Colombet 2017-03-11 00:28:33 +00:00
parent b546174b0e
commit ee8a4f51c4
1 changed files with 3 additions and 9 deletions

View File

@ -1050,9 +1050,7 @@ bool IRTranslator::translate(const Instruction &Inst) {
case Instruction::OPCODE: return translate##OPCODE(Inst, CurBuilder);
#include "llvm/IR/Instruction.def"
default:
if (!TPC->isGlobalISelAbortEnabled())
return false;
llvm_unreachable("unknown opcode");
return false;
}
}
@ -1082,14 +1080,10 @@ bool IRTranslator::translate(const Constant &C, unsigned Reg) {
case Instruction::OPCODE: return translate##OPCODE(*CE, EntryBuilder);
#include "llvm/IR/Instruction.def"
default:
if (!TPC->isGlobalISelAbortEnabled())
return false;
llvm_unreachable("unknown opcode");
return false;
}
} else if (!TPC->isGlobalISelAbortEnabled())
} else
return false;
else
llvm_unreachable("unhandled constant kind");
return true;
}