Why Go compiler implemented own IR?

As I know from online presentation that go use 2 step compiler. It generate IR asm and then translate down to CPU. And this thing is already supported and enhance by LLVM community.
It make interesting to know why GO not adopted LLVM ? Why they develop own IR ?

Go: Frequently Asked Questions (FAQ)

What compiler technology is used to build the compilers?

At the beginning of the project we considered using LLVM for gc but decided it was too large and slow to meet our performance goals. More important in retrospect, starting with LLVM would have made it harder to introduce some of the ABI and related changes, such as stack management, that Go requires but are not part of the standard C setup.


I want to clarify my understanding about Performance goal… mean compilation timing ? Or something else.
Regarding ABI, I am not much aware.

Where can I see how go optimiser work ?
I tried sorting algo in go but I found it have very low performance than C++ with O2 using gcc compiler.

I don’t know of any articles you could check to find this out, but you could check the Go source code to see how it’s implemented: https://golang.org/src/go/

Also, what’s “very low performance” to you?

Yes, the main performance goal we were concerned about was compile speed, not generated code speed.

1 Like

compile speed is awesome, it is real clock time that costs a fortune in wasted developer hours over a long period of time. I have some medium size Java applications that take almost 2 mins to build and package. 2 mins does not sound like much but considering 2 mins x 30 builds you have already lost an hour right there, and 30 bug fix/test cycles is pretty common. That can be 1 or 2 hours a DAY lost time.

Even on my “ancient” i7 6700K even fairly large Go programs the compile time is almost instant on a “slow” (3200 MB/s (read) and 2900 MB/s (write)) NVMe 2 drive.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.