Stream: beginners

Topic: See compiler optimizations?


view this post on Zulip njlr (Jan 12 2024 at 20:09):

I would love to see output of any intermediate language that Roc has, so that I can see the optimizations it has done.

Something like https://godbolt.org/

Is this possible somehow?

view this post on Zulip Anton (Jan 12 2024 at 20:14):

The --emit-llvm-ir flag is what you want I believe

We've talked to the author of godbolt and he would like to add Roc to the website but we haven't had the time to set it up yet.

view this post on Zulip njlr (Jan 13 2024 at 10:40):

I have tried to convert the IR to C in order to inspect it more easily:

llc -march=c -o main.c main.ll

However it seems to not be valid?

llc: error: llc: main.ll:7:22: error: expected type
%str.RocStr = type { ptr, i64, i64 }

Do I need a particular version of the LLVM tools?

Currently on 10:

llc --version
LLVM (http://llvm.org/):
  LLVM version 10.0.0

view this post on Zulip Anton (Jan 13 2024 at 10:42):

Do I need a particular version of the LLVM tools?

Yes, we're on 16.0.6

view this post on Zulip njlr (Jan 13 2024 at 10:43):

Thanks!

Why does Ubuntu have to be so far behind! :rage:

view this post on Zulip Brendan Hansknecht (Jan 13 2024 at 17:02):

I don't think llc can output c

view this post on Zulip Brendan Hansknecht (Jan 13 2024 at 17:02):

Just assembly

view this post on Zulip Brendan Hansknecht (Jan 13 2024 at 17:02):

Which would be harder to read than llvm ir


Last updated: Jul 06 2025 at 12:14 UTC