A Helloworld written in C++ is around 75 lines in LLVM IR.
However, a Helloworld written in Golang compiled with gollvm is around 900/1000 lines of .ll file. I produced the LLVM IR with instructions from
https://go.googlesource.com/gollvm/I'm using LLVM11, so, older compatible commit of gollvm, not sure newer versions are different.
How can I produce shorter/simplified LLVM IR?
Thanks!
Cheers,
Khanh
P/S:
An LLVM IR file has a lot of module asm at the start, like:
module asm "\09.section \22.go_export\22,\22e\22,@progbits"
module asm "\09.ascii \22v3;\\n\22"
module asm "\09.ascii \22package \22"
module asm "\09.ascii \22main\22"
module asm "\09.ascii \22\\n\22"
module asm "\09.ascii \22pkgpath \22"
module asm "\09.ascii \22main\22"
I figure I can delete all the module asm line and my program still runs correctly (I only tested 2 times on simple programs). Is this a legit optimization?