aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-08-08 22:14:20 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-08-08 22:14:20 +0000
commitec62d537369452bf1504a67ab9d3f90c31a6a60f (patch)
tree88a3d0b8f409d15b3682dbddf9d5db03361252ae
parent53843f8edb1ff86f29a1857bb8015deb7cadbce2 (diff)
downloadexternal_llvm-ec62d537369452bf1504a67ab9d3f90c31a6a60f.zip
external_llvm-ec62d537369452bf1504a67ab9d3f90c31a6a60f.tar.gz
external_llvm-ec62d537369452bf1504a67ab9d3f90c31a6a60f.tar.bz2
Add a opt-args option that can be used to pass arguments to every opt
invocation. Fixes PR7793: bugpoint -debug test.ll --opt-args -unroll-count=4 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110555 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--docs/CommandGuide/bugpoint.pod4
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/CommandGuide/bugpoint.pod b/docs/CommandGuide/bugpoint.pod
index 7afeea1..1870a0d 100644
--- a/docs/CommandGuide/bugpoint.pod
+++ b/docs/CommandGuide/bugpoint.pod
@@ -67,6 +67,10 @@ tool.
Pass all arguments specified after B<--gcc-tool-args> to the invocation of
B<gcc>.
+=item B<--opt-args> I<opt args>
+
+Pass all arguments specified after B<--opt-args> to the invocation of B<opt>.
+
=item B<--disable-{dce,simplifycfg}>
Do not run the specified passes to clean up and reduce the size of the test
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 7abcece..ffd4099 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -88,6 +88,10 @@ void BugDriver::EmitProgressBitcode(const Module *M,
cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of running passes (both stdout and stderr)"));
+static cl::list<std::string> OptArgs("opt-args", cl::Positional,
+ cl::desc("<opt arguments>..."),
+ cl::ZeroOrMore, cl::PositionalEatsArgs);
+
/// runPasses - Run the specified passes on Program, outputting a bitcode file
/// and writing the filename into OutputFile if successful. If the
/// optimizations fail for some reason (optimizer crashes), return true,
@@ -154,6 +158,8 @@ bool BugDriver::runPasses(Module *Program,
Args.push_back("-o");
Args.push_back(OutputFilename.c_str());
+ for (unsigned i = 0, e = OptArgs.size(); i != e; ++i)
+ Args.push_back(OptArgs[i].c_str());
std::vector<std::string> pass_args;
for (unsigned i = 0, e = PluginLoader::getNumPlugins(); i != e; ++i) {
pass_args.push_back( std::string("-load"));