@@ -21,18 +21,11 @@ namespace fs = boost::filesystem;
21
21
using namespace compiler_gym ;
22
22
using namespace compiler_gym ::llvm_service;
23
23
24
- int main (int argc, char ** argv) {
25
- google::InitGoogleLogging (argv[0 ]);
26
-
27
- CHECK (argc == 2 ) << " Usage: compute_observation <bitcode-path>" ;
28
-
29
- const fs::path workingDirectory{" ." };
30
-
24
+ void stripOptNoneAttributesOrDie (const fs::path& path, BenchmarkFactory& benchmarkFactory) {
31
25
compiler_gym::Benchmark request;
32
26
request.set_uri (" user" );
33
- request.mutable_program ()->set_uri (fmt::format (" file:///{}" , argv[ 1 ] ));
27
+ request.mutable_program ()->set_uri (fmt::format (" file:///{}" , path. string () ));
34
28
35
- auto & benchmarkFactory = BenchmarkFactory::getSingleton (workingDirectory);
36
29
std::unique_ptr<::llvm_service::Benchmark> benchmark;
37
30
{
38
31
const auto status = benchmarkFactory.getBenchmark (request, &benchmark);
@@ -58,9 +51,20 @@ int main(int argc, char** argv) {
58
51
}
59
52
}
60
53
61
- ASSERT_OK (benchmark->writeBitcodeToFile (argv[ 1 ] ));
62
- std::cerr << " Stripped " << removedOptNoneCount << " optnone attributes from " << argv[ 1 ]
54
+ ASSERT_OK (benchmark->writeBitcodeToFile (path. string () ));
55
+ std::cerr << " Stripped " << removedOptNoneCount << " optnone attributes from " << path. string ()
63
56
<< std::endl;
57
+ }
58
+
59
+ int main (int argc, char ** argv) {
60
+ google::InitGoogleLogging (argv[0 ]);
61
+
62
+ const fs::path workingDirectory{" ." };
63
+ auto & benchmarkFactory = BenchmarkFactory::getSingleton (workingDirectory);
64
+
65
+ for (int i = 1 ; i < argc; ++i) {
66
+ stripOptNoneAttributesOrDie (argv[i], benchmarkFactory);
67
+ }
64
68
65
69
return 0 ;
66
70
}
0 commit comments