# Using the \`opt\` from Julia's LLVM?

**URL:** <https://discourse.julialang.org/t/using-the-opt-from-julias-llvm/112161>\
**Category:** General Usage\
**Created:** [March 26, 2024, 9:54pm UTC](https://discourse.julialang.org/t/using-the-opt-from-julias-llvm/112161 "2024-03-26T21:54:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cgeoga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cgeoga/32/216186_2.png) [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Post date:** [March 26, 2024, 9:54pm UTC](https://discourse.julialang.org/t/using-the-opt-from-julias-llvm/112161/1 "2024-03-26T21:54:18Z")

</div>

Hi all—

This may be a bit of a weird one, but I’m looking for a way to use the `opt` from Julia’s LLVM on some `*.ll` files. The “why” is that I am compiling Enzyme with Julia’s LLVM following the dev docs [here](https://enzymead.github.io/Enzyme.jl/stable/dev_docs/), which is _much_ more pleasant than building LLVM from source and then building Enzyme against that. But as the usage docs [here](https://enzyme.mit.edu/getting_started/UsingEnzyme/) suggest, you need to use the same LLVM you built Enzyme with (and I can confirm things crash when you don’t, at least for my specific machine/distro/whatever).

I have to imagine I’m missing something obvious that I should be finding with `grep`/`rg` or `find`/`fd` in `~/.julia/`, but unfortunately the three characters `opt` come up a fair amount everywhere and I haven’t been able to find the right `opt` needle in the haystack. If anybody has any pointers here I would greatly appreciate it.

If what I’m asking for isn’t possible, I would be very curious to hear about other people who build Enzyme against Julia’s LLVM and then differentiate C code with that Enzyme build.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [March 27, 2024, 12:35am UTC](https://discourse.julialang.org/t/using-the-opt-from-julias-llvm/112161/2 "2024-03-27T00:35:14Z")

</div>

There is a jll that provides the opt. You can either use `LLVM_jll` or `LLVM_full_jll`.

Those both should have `opt` available from.

---

<div class="post-metadata">

**Author:** ![cgeoga](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cgeoga/32/216186_2.png) [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Post date:** [March 27, 2024, 2:55pm UTC](https://discourse.julialang.org/t/using-the-opt-from-julias-llvm/112161/3 "2024-03-27T14:55:06Z")

</div>

Hi Valentin—thanks so much! I have this working and will submit a PR to the docs relevant docs to spell out the process for the next folks who want to try it.
