# Differences in valid options accepted by opt and JULIA\_LLVM\_ARGS

**URL:** <https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513>\
**Category:** Internals & Design\
**Tags:** question, llvm\
**Created:** [March 7, 2017, 8:42am UTC](https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513 "2017-03-07T08:42:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![singam-sanjay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singam-sanjay/32/1721_2.png) [@singam-sanjay](https://discourse.julialang.org/u/singam-sanjay)\
**Post date:** [March 7, 2017, 8:42am UTC](https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513/1 "2017-03-07T08:42:02Z")

</div>

## 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](http://llvm.org/docs/doxygen/html/namespacellvm_1_1cl.html#abc4b92e1d79cd1ad2f3d70076fb55199) in llvm/lib/Support/CommandLine.cpp, is used to parse arguments by calling it through the [GlobalParser](http://llvm.org/docs/doxygen/html/CommandLine_8cpp.html#a391287ed187d72f0c6b3ebe84178bda9) object by both Julia and opt.

(I’ve enabled and added few debug statements)

```julia-auto
$ 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

---

<div class="post-metadata">

**Author:** ![tobig](https://avatars.discourse-cdn.com/v4/letter/t/ac91a4/32.png) [@tobig](https://discourse.julialang.org/u/tobig)\
**Post date:** [March 7, 2017, 12:44pm UTC](https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513/2 "2017-03-07T12:44:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![singam-sanjay](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singam-sanjay/32/1721_2.png) [@singam-sanjay](https://discourse.julialang.org/u/singam-sanjay)\
**Post date:** [March 7, 2017, 1:27pm UTC](https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513/3 "2017-03-07T13:27:59Z")

</div>

Yes, that’s why I’m passing it via JULIA\_LLVM\_ARGS and not putting it after ./julia .

---

<div class="post-metadata">

**Author:** ![Tobias\_Grosser](https://avatars.discourse-cdn.com/v4/letter/t/cc9497/32.png) [@Tobias\_Grosser](https://discourse.julialang.org/u/Tobias_Grosser)\
**Post date:** [March 7, 2017, 2:09pm UTC](https://discourse.julialang.org/t/differences-in-valid-options-accepted-by-opt-and-julia-llvm-args/2513/4 "2017-03-07T14:09:34Z")

</div>

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
