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 <i...@golang.org> wrote:

> On Mon, Sep 13, 2021 at 6:03 AM Khanh TN <tnkha...@gmail.com> 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 Khanh TN wrote:
> >>
> >> 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 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 data from some other non-main package.
> >>>
> >>> Export data tends to be substantial because it is based on the
> transitive closure of the imported packages (e.g. "fmt" imports "io", then
> "io" imports "sync", then "sync" imports "runtime", and so on).
> >>>
> >>> On the other hand, Go export data is way smaller than the volume of
> header information that would have to be consumed by a C++ compiler when
> building your average C++ source file.
> >>>
> >>> Than
> >>>
> >>> On Thu, Sep 9, 2021 at 6:31 AM Khanh TN <tnkh...@gmail.com> wrote:
> >>>>
> >>>> 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...@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
> .
> >
> > --
> > 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/abf02438-5740-46e1-8577-2e001b3960f7n%40googlegroups.com
> .
>
> --
> 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/CAOyqgcV%2BMR2FBArbR6ZNgCgs1DbO_Hwccu%2BOD3SuvLLRm6%2Bqcg%40mail.gmail.com
> .
>

-- 
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/CA%2BUr55EwO3HOPK7bw819ic_xDBFJhPCgPDmVkb%2BO%3Dgfu8%2B85Eg%40mail.gmail.com.

Reply via email to