From: Quentin Colombet Date: Sat, 11 Mar 2017 00:28:33 +0000 (+0000) Subject: [IRTranslator] Simplify error handling for translating constants. NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b893e797a57ccfe589eae8b76f442a1c0e3e3fc2;p=llvm [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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297535 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4f9b907c4f8..7e6c61dfca6 100644 --- a/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/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; }