[llvm] r233252 - bugpoint: Return early after error, NFC

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Mar 25 22:03:06 PDT 2015


Author: dexonsmith
Date: Thu Mar 26 00:03:06 2015
New Revision: 233252

URL: http://llvm.org/viewvc/llvm-project?rev=233252&view=rev
Log:
bugpoint: Return early after error, NFC

Modified:
    llvm/trunk/tools/bugpoint/BugDriver.cpp

Modified: llvm/trunk/tools/bugpoint/BugDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/BugDriver.cpp?rev=233252&r1=233251&r2=233252&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/BugDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/BugDriver.cpp Thu Mar 26 00:03:06 2015
@@ -86,23 +86,23 @@ std::unique_ptr<Module> llvm::parseInput
                                              LLVMContext &Ctxt) {
   SMDiagnostic Err;
   std::unique_ptr<Module> Result = parseIRFile(Filename, Err, Ctxt);
-  if (!Result)
+  if (!Result) {
     Err.print("bugpoint", errs());
+    return Result;
+  }
 
   // If we don't have an override triple, use the first one to configure
   // bugpoint, or use the host triple if none provided.
-  if (Result) {
-    if (TargetTriple.getTriple().empty()) {
-      Triple TheTriple(Result->getTargetTriple());
-
-      if (TheTriple.getTriple().empty())
-        TheTriple.setTriple(sys::getDefaultTargetTriple());
+  if (TargetTriple.getTriple().empty()) {
+    Triple TheTriple(Result->getTargetTriple());
 
-      TargetTriple.setTriple(TheTriple.getTriple());
-    }
+    if (TheTriple.getTriple().empty())
+      TheTriple.setTriple(sys::getDefaultTargetTriple());
 
-    Result->setTargetTriple(TargetTriple.getTriple());  // override the triple
+    TargetTriple.setTriple(TheTriple.getTriple());
   }
+
+  Result->setTargetTriple(TargetTriple.getTriple()); // override the triple
   return Result;
 }
 





More information about the llvm-commits mailing list