Hi Matt again,
I hope you are well and healthy!
I thought of 2 ideas that I think are going to make the experience of compiling with
Clang in Godbolt better:
1) fno-discard-value-names by default
It seems that you're using release builds of Clang in godbolt which makes sense.
Release builds however, have (sort of) -fdiscard-value-names set by default.
This means that if we emit LLVM IR, all the values and BB labels have auto-incremented
printed values (%0, %1, ...). I think this makes the LLVM IR quite harder to read for no actual
reason.
If you agree, I think you can make the experience better using one of two simple solutions:
a) Use source builds. That may not be that efficient (to deploy) but these give the best naming.
They obviously have other benefits.
b) The easiest is to pass -fno-discard-value-names (
https://godbolt.org/z/iv4UoW) by default, or give an option for the user to enable it (Note that even if it's passed by default,
the user can pass -fno-discard-value-names to disable it).
You might say but well the user can just pass it but actually, it's quite
possible that the user does not know that this cmd arg even exists.
2) Graph output of LLVM IR
I saw this option a couple days ago and oh my god how amazing it is for ASM.
Thank you so much for enabling this!
I was thinking that maybe this can be enabled in LLVM IR. I don't know if I'm doing
something wrong but when I use Graph Output for LLVM IR, it opens only one BB at a time.
The weird thing is that it seems to identify BBs correctly, but we can only see one at a time
and there are no connections.
How easy would be to improve that ? If I can help, please tell me.
I was thinking that even if we can't support all the terminators (switches etc.) at least
at the start, supporting the ones used 99% of the time, i.e. (un)conditional branches, should be
plausible.
As a side note, LLVM has the -view-cfg option that lets you view the CFG
graphically but it's not very convenient honestly. Using godbolt (like with ASM) should be orders
of magnitude better.
Kind regards,
Stefanos Baziotis