From ee8a4f51c4f01de2eba8a018539905aa674f8dff Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Sat, 11 Mar 2017 00:28:33 +0000 Subject: [PATCH] [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 --- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4f9b907c4f84..7e6c61dfca67 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -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; }