]> granicus.if.org Git - llvm/commitdiff
[IRTranslator] Simplify error handling for translating constants. NFC.
authorQuentin Colombet <qcolombet@apple.com>
Sat, 11 Mar 2017 00:28:33 +0000 (00:28 +0000)
committerQuentin Colombet <qcolombet@apple.com>
Sat, 11 Mar 2017 00:28:33 +0000 (00:28 +0000)
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

lib/CodeGen/GlobalISel/IRTranslator.cpp

index 4f9b907c4f84b84c1ecda987d82fb22f9947e326..7e6c61dfca6777096f86e9d88594a215209ac158 100644 (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;
 }