[PATCH] D13642: [Bugpoint] Allow fallback to clang

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 11 17:27:36 PDT 2015


davide created this revision.
davide added a reviewer: hfinkel.
davide added a subscriber: llvm-commits.
davide set the repository for this revision to rL LLVM.

FreeBSD doesn't ship with gcc by default anymore, so some bugpoint tests fail on a stock installation.
In D12273 I proposed to XFAIL the tests on FreeBSD, but Hal replied proposing to fallback on clang if gcc is not available.
This patch implements the proposed logic. Hal, I listed you as reviewer because you're the one that came up with this idea and apparently Bugpoint is currently unowned. Feel free to remove yourself and/or suggest somebody else that should review this.

Repository:
  rL LLVM

http://reviews.llvm.org/D13642

Files:
  tools/bugpoint/ExecutionDriver.cpp
  tools/bugpoint/ToolRunner.cpp

Index: tools/bugpoint/ToolRunner.cpp
===================================================================
--- tools/bugpoint/ToolRunner.cpp
+++ tools/bugpoint/ToolRunner.cpp
@@ -546,8 +546,13 @@
 
   GCC *gcc = GCC::create(Message, GCCBinary, GCCArgs);
   if (!gcc) {
-    errs() << Message << "\n";
-    exit(1);
+
+    // Try to fall-back to clang.
+    gcc = GCC::create(Message, "clang", GCCArgs);
+    if (!gcc) {
+      errs() << Message << "\n";
+      exit(1);
+    }
   }
   Message = "Found llc: " + LLCPath + "\n";
   return new LLC(LLCPath, gcc, Args, UseIntegratedAssembler);
Index: tools/bugpoint/ExecutionDriver.cpp
===================================================================
--- tools/bugpoint/ExecutionDriver.cpp
+++ tools/bugpoint/ExecutionDriver.cpp
@@ -253,7 +253,16 @@
   if (!SafeInterpreter) { outs() << Message << "\nExiting.\n"; exit(1); }
 
   gcc = GCC::create(Message, GCCBinary, &GCCToolArgv);
-  if (!gcc) { outs() << Message << "\nExiting.\n"; exit(1); }
+  if (!gcc) {
+
+    // Try to fall-back to clang.
+    GCCBinary = "clang";
+    gcc = GCC::create(Message, GCCBinary, &GCCToolArgv);
+    if (!gcc) {
+      outs() << Message << "\nExiting.\n";
+      exit(1);
+    }
+  }
 
   // If there was an error creating the selected interpreter, quit with error.
   return Interpreter == nullptr;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13642.37076.patch
Type: text/x-patch
Size: 1334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151012/06c122f8/attachment.bin>


More information about the llvm-commits mailing list