Differences in valid options accepted by opt and JULIA_LLVM_ARGS

question
llvm

#1

Different sources of valid options for GlobalParser?

Hello,

Julia fails to accept certain options that were accepted by opt from Julia’s LLVM build. I see the same function, CommandLineParser::ParseCommandLineOptions in llvm/lib/Support/CommandLine.cpp, is used to parse arguments by calling it through the GlobalParser object by both Julia and opt.

(I’ve enabled and added few debug statements)

$ JULIA_LLVM_ARGS="-polly-scops" ./julia
/home/sanjay/Software/polly_julia/llvm_src/lib/Support/CommandLine.cpp:1042:ParseCommandLineOptions
Program: Options: -enable-tail-merge=0
Args:  -enable-tail-merge=0 
/home/sanjay/Software/polly_julia/llvm_src/lib/Support/CommandLine.cpp:996:ParseEnvironmentOptions
Julia:JULIA_LLVM_ARGS:
/home/sanjay/Software/polly_julia/llvm_src/lib/Support/CommandLine.cpp:1042:ParseCommandLineOptions
Program:Julia Options: -polly-scops
Julia: (->)Unknown command line argument '-polly-scops'(<-).  Try: 'Julia -help'
Julia: Did you mean '-polly-show'?
Args: Julia -polly-scops 
$ ../llvm_build/bin/opt -polly-scops
/home/sanjay/Software/polly_julia/llvm_src/lib/Support/CommandLine.cpp:1042:ParseCommandLineOptions
Program:../llvm_build/bin/opt Options: -polly-scops
Args: ../llvm_build/bin/opt -polly-scops 
^C
$

Is GlobalParser populated differently when invoked through Julia compared to when it’s invoked by opt ?

Thank You,
Sanjay Srivallabh


#2

-polly-scops is an LLVM pass. Options that schedule LLVM passes are only accepted by ‘opt’, but not by clang / julia.


#3

Yes, that’s why I’m passing it via JULIA_LLVM_ARGS and not putting it after ./julia .


#4

You can also not pass these arguments to JULIA_LLVM_ARGS. These options
are added in

git/tools/opt/opt.cpp:

static cl::list<const PassInfo*, bool, PassNameParser>
PassList(cl::desc(“Optimizations available:”));

So are not available in clang/julia at all.

Tobias