IPA and LTO
Hello, I have written a simple ipa pass and would like to make use of Link time optimisation. My pass requires access to the function bodies and ideally I would like the driver function to be called once at link time and have access to functions in all of the files as if they were one compilation unit. The documentation would indicate that this is possible, but ad hoc instrumentation of some of the other simple ipa passes seems to suggest different behaviour. 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. I am using GCC 4.6.0 with the gold linker plugin (binutils 2.21). Andrew -- View this message in context: http://old.nabble.com/IPA-and-LTO-tp32052768p32052768.html Sent from the gcc - Dev mailing list archive at Nabble.com.
IPA and LTO
Hello, I have written a simple ipa pass and would like to make use of Link time optimisation. My pass requires access to the function bodies and ideally I would like the driver function to be called once at link time and have access to functions in all of the files as if they were one compilation unit. The documentation would indicate that this is possible, but ad hoc instrumentation of some of the other simple ipa passes seems to suggest different behaviour. 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. I am using GCC 4.6.0 with the gold linker plugin (binutils 2.21). Andrew -- View this message in context: http://old.nabble.com/IPA-and-LTO-tp32052838p32052838.html Sent from the gcc - Dev mailing list archive at Nabble.com.
Re: IPA and LTO
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. Diego Novillo-3 wrote: > > On Wed, Jul 13, 2011 at 10:22, AJM-2 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.
Re: IPA and LTO
Putting my "simple IPA pass" adjacent to IPA-PTA does cause it to be called as expected. However for each node in the call graph (with cgraph_function_body_availability returning AVAIL_AVAILABLE), gimple_has_body_p is always false. The call graph data seems to be available, but the documentation indicates that access to the gimple is also possible, using the standard accessors. Is there some extra step that must be taken to access gimple under LTO? Richard Guenther-2 wrote: > > 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. > > -- View this message in context: http://old.nabble.com/IPA-and-LTO-tp32052838p32056682.html Sent from the gcc - Dev mailing list archive at Nabble.com.
Is it possible to get unpartitioned LTO with Fortran?
Hi, I have a simple IPA pass that requires access to all function bodies in a program. For C and small Fortran programs doing this at link time causes no issues. However, when I attempt to compile a larger Fortran program the pass is called multiple times at link time, each time with only a portion of the function bodies available. Is there anyway to force unpartitioned (i.e. single execution) of my pass on these Fortran programs, with access to all the function bodies? I am using GCC 4.7 with gold linker. Cheers, Andrew -- View this message in context: http://old.nabble.com/Is-it-possible-to-get-unpartitioned-LTO-with-Fortran--tp33732132p33732132.html Sent from the gcc - Dev mailing list archive at Nabble.com.