Differences in valid options accepted by opt and JULIA_LLVM_ARGS

Different sources of valid options for GlobalParser?


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
Program: Options: -enable-tail-merge=0
Args:  -enable-tail-merge=0 
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
Program:../llvm_build/bin/opt Options: -polly-scops
Args: ../llvm_build/bin/opt -polly-scops 

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

Thank You,
Sanjay Srivallabh

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

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

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


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

So are not available in clang/julia at all.