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?

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8ee91024-b270-4d1e-99b9-dbcd3e25d4c4n%40googlegroups.com.

Reply via email to