On Wed, Jul 13, 2011 at 5:54 PM, AJM-2 <mcpherson...@gmail.com> wrote:
>
> What you say is in line with my understanding, however when I instrument the
> execute function of ipa-function-and-variable-visibility
> (local_function_and_variable_visibility()) I note that:
>
> gcc -flto a.c b.c
> causes the pass to be called twice (presumably once per file).
>
> If I split the compilation into two stages, then in the link stage
> gcc -flto a.o b.o
> the pass is never called.
>
> Conversely, the gate of IPA-Points-to does seem to be called three times at
> link time (presumably once for each file and then once for all together).  I
> cannot discover the cause of the different behaviours here.

It depends on where in the pass pipeline you put your IPA pass.  A simple
IPA pass that should run at ltrans time (either seeing each partition for
the partitioned program or the whole program if you use one partition)
needs to be put alongside IPA PTA (that's the only simple IPA pass executed
at link LTO time right now).

Richard.

>
> Diego Novillo-3 wrote:
>>
>> On Wed, Jul 13, 2011 at 10:22, AJM-2 <mcpherson...@gmail.com> wrote:
>>
>>> My question is whether LTO can be used in this way, to have a simple ipa
>>> pass called once at link time with access to the function bodies, and if
>>> so
>>> how is this achieved?  cgraph_function_body_availability seems to only be
>>> half the story.
>>
>> Yes, it can.  You seem to be describing what GCC calls "simple IPA
>> pass".  These are passes that cannot run in partitioned LTO mode, as
>> they require the function bodies to operate.  Look for passes like
>> pass_ipa_function_and_variable_visibility for an example of a simple
>> IPA pass.
>>
>>
>> Diego.
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/IPA-and-LTO-tp32052838p32054720.html
> Sent from the gcc - Dev mailing list archive at Nabble.com.
>
>

Reply via email to