Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-14 Thread Khanh TN
So, I figured out this inline asm ends with a "checksum" then ".text". I think I can remove inline asm before this ".text" and keep the rest since it might be useful. Please correct me if I'm wrong. Thanks for your support! Khanh On Wednesday, September 15, 2021 at 11:59:25 AM UTC+8 Khanh TN wr

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-14 Thread Khanh TN
Hi, Thanks, Than and Ian for your responses. I would like to write an LLVM Pass to remove this export data. What is the best way to do that? I am thinking module M.setModuleInlineAsm(""); But that might remove other useful inline asm. Khanh On Tuesday, September 14, 2021 at 1:54:03 AM UTC+8 th.

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-13 Thread 'Than McIntosh' via golang-nuts
I feel as though we're getting into the realm of "what is the sound of one hand clapping"... ? Than On Mon, Sep 13, 2021 at 1:51 PM Ian Lance Taylor wrote: > On Mon, Sep 13, 2021 at 6:03 AM Khanh TN wrote: > > > > Also, from what I understand, if noone imports my package, I can also > remove

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-13 Thread Ian Lance Taylor
On Mon, Sep 13, 2021 at 6:03 AM Khanh TN wrote: > > Also, from what I understand, if noone imports my package, I can also remove > the "module asm" lines at the start. Is that right? What is the use of a package that nobody imports? Ian > On Monday, September 13, 2021 at 9:18:20 AM UTC+8 Khan

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-13 Thread Khanh TN
Also, from what I understand, if noone imports my package, I can also remove the "module asm" lines at the start. Is that right? Khanh On Monday, September 13, 2021 at 9:18:20 AM UTC+8 Khanh TN wrote: > Hi, > Thanks, Than, for the answer. > So, if the .go file I'm compiling is the one with "pac

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-12 Thread Khanh TN
Hi, Thanks, Than, for the answer. So, if the .go file I'm compiling is the one with "package main" "func main()", I can remove the "module asm" lines without any consequences? Khanh On Friday, September 10, 2021 at 9:09:12 PM UTC+8 th...@google.com wrote: > Hi, > > The "module asm" at the start

Re: [go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-10 Thread 'Than McIntosh' via golang-nuts
Hi, The "module asm" at the start of your bitcode dump is actually the export data for the package, so it plays a pretty crucial role. Deleting the export data from the "main" package may work in some cases (since nobody imports main), but it will certainly cause problems if you delete the export

[go-nuts] Simplifying LLVM bitcode from gollvm

2021-09-09 Thread Khanh TN
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