Re-commit "llvm-isel-fuzzer: Handle a subset of backend flags in the exec name"
Here we add a secondary option parser to llvm-isel-fuzzer (and provide
it for use with other fuzzers). With this, you can copy the fuzzer to
a name like llvm-isel-fuzzer=aarch64-gisel for a fuzzer that fuzzer
AArch64 with GlobalISel enabled, or fuzzer=x86_64 to fuzz x86, with no
flags required. This should be useful for running these in OSS-Fuzz.
Note that this handrolls a subset of cl::opts to recognize, rather
than embedding a complete command parser for argv[0]. If we find we
really need the flexibility of handling arbitrary options at some
point we can rethink this.
This re-applies 315545 using "=" instead of ":" as a separator for
arguments.
llvm-svn: 315557
diff --git a/llvm/test/tools/llvm-isel-fuzzer/aarch64-execname-options.ll b/llvm/test/tools/llvm-isel-fuzzer/aarch64-execname-options.ll
new file mode 100644
index 0000000..baf4b0f
--- /dev/null
+++ b/llvm/test/tools/llvm-isel-fuzzer/aarch64-execname-options.ll
@@ -0,0 +1,15 @@
+; REQUIRES: aarch64-registered-target
+
+; RUN: echo > %t.input
+
+; RUN: cp llvm-isel-fuzzer %t.bin=aarch64
+; RUN: %t.bin=aarch64 %t.input 2>&1 | FileCheck -check-prefix=AARCH64 %s
+; AARCH64: Injected args: -mtriple=aarch64
+
+; RUN: cp llvm-isel-fuzzer %t.bin=aarch64-O1
+; RUN: %t.bin=aarch64-O1 %t.input 2>&1 | FileCheck -check-prefix=OPT-AFTER %s
+; OPT-AFTER: Injected args: -mtriple=aarch64 -O1
+
+; RUN: cp llvm-isel-fuzzer %t.bin=O3-aarch64
+; RUN: %t.bin=O3-aarch64 %t.input 2>&1 | FileCheck -check-prefix=OPT-BEFORE %s
+; OPT-BEFORE: Injected args: -O3 -mtriple=aarch64