http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60911
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 23 Apr 2014, jamborm at gcc dot gnu.org wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60911 > > --- Comment #3 from Martin Jambor <jamborm at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #2) > > Late IPA passes need all regular IPA transforms applied and clones > > materialized. > > I agree that would make sense but it is not what we do. Just look at > compile() in cgraphunit.c. When late IPA passes run, clones are > already materialized but transformation phases of regular IPA passes > have not been run yet. Apart from the fact that late-IPA passes do > not see the bodies transformed and inlining performed it also means > that call statements have not been updated to reflect call > redirections performed at analysis stage which is the problem here and > which is (for reasons I have never quite grasped) done as a part of > inlining transformation phase. Hmm, ok. But that makes "simple" IPA passes work on a limbo state. I think we delay applying IPA transforms as "optimization" with respect to compile-time/memory-use as in theory we only require a single function body in memory during LTRANS. I wonder why it works without LTO ... because there I _do_ see the IPA transform applied to main (). > OTOH, I am all for moving the call to execute_all_ipa_transforms() > from expand_function() to compile(), at least in trunk. We also have, in execute_one_pass, /* SIPLE IPA passes do not handle callgraphs with IPA transforms in it. Apply all trnasforms first. */ if (pass->type == SIMPLE_IPA_PASS) { bool applied = false; do_per_function (apply_ipa_transforms, (void *)&applied); if (applied) symtab_remove_unreachable_nodes (true, dump_file); /* Restore current_pass. */ current_pass = pass; but that doesn't seem to work ... at least with LTO? Which is because for main() FOR_EACH_DEFINED_FUNCTION (node) if (node->analyzed && gimple_has_body_p (node->decl) && (!node->clone_of || node->decl != node->clone_of->decl)) { this doesn't trigger (for f.constprop it does). gimple_has_body_p (node->decl) is false. main/1 (main) @0x7ffff6daf148 Type: function definition analyzed Visibility: externally_visible prevailing_def public References: Referring: Read from file: /tmp/ccED1aQr.ltrans0.o Availability: available First run: 0 Function flags: only_called_at_startup Called by: Calls: abort/2 (0.00 per call) f.constprop.0/3 (1.00 per call) it's probably not yet streamed in?