public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Devang Patel <dpatel@apple.com>
To: Nick Kledzik <kledzik@apple.com>,  Ian Lance Taylor <iant@google.com>
Cc: Chris Lattner <clattner@apple.com>,
	 Diego Novillo <dnovillo@google.com>,
	 GCC Mailing List <gcc@gcc.gnu.org>,
	 Kenneth Zadeck <zadeck@naturalbridge.com>,
	 Jan Hubicka <jh@suse.cz>,
	 Rafael Espindola <espindola@google.com>,
	 Ollie Wild <aaw@google.com>,  Robert Hundt <rhundt@google.com>
Subject: Re: [whopr] Design/implementation alternatives for the driver and WPA
Date: Thu, 05 Jun 2008 05:07:00 -0000	[thread overview]
Message-ID: <0695A6FD-42D5-4045-9722-6C060979CEAC@apple.com> (raw)
In-Reply-To: <ED85AE1C-04D7-44EB-A703-B119CD3D44A1@apple.com>


On Jun 4, 2008, at 6:09 PM, Nick Kledzik wrote:

>
> On Jun 4, 2008, at 5:39 PM, Ian Lance Taylor wrote:
>> Nick Kledzik <kledzik@apple.com> writes:
>>
>>> On Jun 4, 2008, at 5:00 PM, Ian Lance Taylor wrote:
>>>> Nick Kledzik <kledzik@apple.com> writes:
>>>>
>>>>> I don't claim our current implementation is bug free, but the lto
>>>>> interface
>>>>> matches the Apple linker internal model, so we don't expect and  
>>>>> have
>>>>> not encountered any problems mixing mach-o and llvm bitcode files.
>>>>
>>>> Hmmm, OK, how about this example:
>>>>
>>>> a.o: contains LTO information, refers to S
>>>> b.o: no LTO information, defines S
>>>> c.o: contains LTO information, defines S at version V, S/V is not
>>>> hidden
>>>>
>>>> In the absence of b.o, the reference to S in a.o will be resolved
>>>> against the definition of S in c.o.  In the presence of b.o, the
>>>> reference to S in a.o will be resolved against the definition of  
>>>> S in
>>>> b.o.
>>>>
>>>> I suppose we could refuse to inline versioned symbols, but that
>>>> doesn't seem desirable since it is normally fine.
>>>
>>>
>>> As Chris mentioned earlier today, the Apple tool chain does not
>>> support versioned symbols.
>>> But if versioned symbols are a naming convention (that is everything
>>> is encoded in
>>> the symbol name), then this would work the same as your previous
>>> example.  Namely,
>>> the linker would coalesce away S in c.o, which in turns tell the LTO
>>> engine that it
>>> can't inline/optimize away c.o's S and after LTO is done, the linker
>>> throws away
>>> the LTO generated S and uses b.o's S instead.
>>
>> Versioned symbols are not a naming convention, but they aren't all
>> that different from one.  Basically every symbol may have an optional
>> version, and when a symbol has a version the version may be hidden or
>> not.  A symbol definition with a hidden version may only be matched  
>> by
>> a symbol reference with that exact version.  A symbol definition with
>> a non-hidden version definition may be matched by a symbol reference
>> with the same name without a version.  This is most interesting in  
>> the
>> dynamic linker, of course.
>>
>> How does the linker inform the plugin that the plugin is not  
>> permitted
>> to use c.o's S?
> In the previous case where S was weak, the call to  
> lto_codegen_add_must_preserve_symbol("S")
> caused the LTO engine to know it could not inline S (because it was
> a weak definition and used outside the LTO usage sphere).

weak definition is the deciding factor. Optimizer can inline a  
function at the call site irrespective of whether it is used outside  
LTO usage sphere or not. The outside the LTO sphere use determines  
whether to preserve the function body, when the function is inlined  
everywhere inside LTO usage sphere,  or not.

> And then
> after LTO was done, the linker threw away the LTO produced S and used
> the one from c.o instead.
>
> In this case S is a regular symbol.  So the previous trick won't  
> work.  Probably
> the best solution would be to add a new  lto_ API to tell the LTO  
> engine to
> ignore a definition is already has.  It would make more sense to use  
> this
> new API in the weak case too.

If the optimizer can handle the symbol versioning case when one  
definition with version is defined in the same source file as the  
reference then you don't need new API.

For example,

a.o : refers to S and defines S at version V.
b.o : defines S.

Is inliner, at compile time allowed to inline uses of S in a.o using  
the definition it has ?

-
Devang

  reply	other threads:[~2008-06-05  5:07 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 16:46 Diego Novillo
2008-06-04  2:27 ` Chris Lattner
2008-06-04  7:28   ` Rafael Espindola
2008-06-04 16:34     ` Chris Lattner
2008-06-04 16:48       ` Rafael Espindola
2008-06-04 13:00   ` Diego Novillo
2008-06-04 15:28     ` Kenneth Zadeck
2008-06-04 15:54       ` Ian Lance Taylor
2008-06-04 16:50         ` Kenneth Zadeck
2008-06-04 17:05           ` Diego Novillo
2008-06-04 17:37           ` Ian Lance Taylor
2008-06-04 16:15       ` Chris Lattner
     [not found]         ` <65dd6fd50806041223l1871ecfbh384aa175c3da0645@mail.gmail.com>
2008-06-04 19:30           ` Fwd: " Ollie Wild
     [not found]           ` <89069638-6D2B-4AE6-ACB3-99A2B09091BA@apple.com>
2008-06-04 20:02             ` Ollie Wild
2008-06-04 23:59             ` Diego Novillo
2008-06-04 20:03           ` Kenneth Zadeck
2008-06-04 20:30             ` Ian Lance Taylor
2008-06-04 20:56             ` Diego Novillo
2008-06-05 15:10               ` Jan Hubicka
2008-06-05 15:23                 ` Diego Novillo
2008-06-04 14:28   ` Ian Lance Taylor
2008-06-04 16:29     ` Chris Lattner
2008-06-04 16:41       ` Chris Lattner
2008-06-04 18:48       ` Devang Patel
2008-06-04 19:45       ` Ian Lance Taylor
2008-06-04 20:38         ` Nick Kledzik
2008-06-04 20:46           ` Ian Lance Taylor
2008-06-04 21:43             ` Nick Kledzik
2008-06-05  0:01               ` Ian Lance Taylor
2008-06-05  0:20                 ` Nick Kledzik
2008-06-05  0:43                   ` Ian Lance Taylor
2008-06-05  1:09                     ` Nick Kledzik
2008-06-05  5:07                       ` Devang Patel [this message]
2008-06-05  5:43                         ` Ian Lance Taylor
2008-06-05  6:09                           ` [whopr] plugin interface design Chris Lattner
2008-06-05 13:53                             ` Ian Lance Taylor
2008-06-05 16:37                               ` Chris Lattner
2008-06-05 17:39                                 ` Ian Lance Taylor
2008-06-07 18:31                                   ` Chris Lattner
2008-06-05  5:44                       ` [whopr] Design/implementation alternatives for the driver and WPA Ian Lance Taylor
2008-06-05  8:41           ` Rafael Espindola
2008-06-05 14:00             ` Ian Lance Taylor
2008-06-05 16:44               ` Chris Lattner
2008-06-05 17:44                 ` Ian Lance Taylor
2008-06-05 18:50                   ` Nick Kledzik
2008-06-05 21:03                     ` Ian Lance Taylor
2008-06-05 21:47                       ` Chris Lattner
2008-06-06  1:22                         ` Ian Lance Taylor
2008-06-07 18:34                           ` Chris Lattner
     [not found]   ` <65dd6fd50806032310u2bda0953qb911e3ccfe3f305e@mail.gmail.com>
2008-06-04 19:29     ` Fwd: " Ollie Wild
2008-06-04 14:45 ` Ian Lance Taylor
2008-06-04 14:48   ` Diego Novillo
2008-06-04 15:28   ` Rafael Espindola
2008-06-04 16:31 ` Mark Mitchell
2008-07-04  3:31 ` Cary Coutant
2008-07-04  6:28   ` Ian Lance Taylor
2008-07-04 22:58     ` Daniel Jacobowitz
2008-07-06  7:30     ` Cary Coutant
2008-07-07  6:13       ` Ian Lance Taylor
2008-07-04 13:43   ` Rafael Espindola
2008-07-06 14:22     ` Cary Coutant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0695A6FD-42D5-4045-9722-6C060979CEAC@apple.com \
    --to=dpatel@apple.com \
    --cc=aaw@google.com \
    --cc=clattner@apple.com \
    --cc=dnovillo@google.com \
    --cc=espindola@google.com \
    --cc=gcc@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=jh@suse.cz \
    --cc=kledzik@apple.com \
    --cc=rhundt@google.com \
    --cc=zadeck@naturalbridge.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).