From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17295 invoked by alias); 24 Feb 2014 13:00:49 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 17245 invoked by uid 48); 24 Feb 2014 13:00:45 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/60315] [4.8/4.9 Regression] template constructor switch optimization Date: Mon, 24 Feb 2014 13:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: compile-time-hog X-Bugzilla-Severity: minor X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg02441.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60315 --- Comment #4 from Richard Biener --- When calling do_estimate_edge_size to compute the effect on caller size when inlining an edge we call estimate_node_size_and_time which eventually recurses down to estimate_calls_size_and_time (why!? call edges in the callee are irrelevant when inlining the call into the caller!). Doesn't this just want to add(?) e->call_stmt_size/time? At the moment estimate_calls_size_and_time recurses to estimate_edge_size_and_time ... and I don't see _any_ prevention of running in cgraph cycles here. (and the cache isn't populated before computing an edges size/time is). In fact, Index: gcc/ipa-inline-analysis.c =================================================================== --- gcc/ipa-inline-analysis.c (revision 207960) +++ gcc/ipa-inline-analysis.c (working copy) @@ -3011,21 +3011,11 @@ estimate_calls_size_and_time (struct cgr struct inline_edge_summary *es = inline_edge_summary (e); if (!es->predicate || evaluate_predicate (es->predicate, possible_truths)) - { - if (e->inline_failed) - { - /* Predicates of calls shall not use NOT_CHANGED codes, - sowe do not need to compute probabilities. */ - estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, - known_vals, known_binfos, - known_aggs, hints); - } - else - estimate_calls_size_and_time (e->callee, size, time, hints, - possible_truths, - known_vals, known_binfos, - known_aggs); - } + /* Predicates of calls shall not use NOT_CHANGED codes, + sowe do not need to compute probabilities. */ + estimate_edge_size_and_time (e, size, time, REG_BR_PROB_BASE, + known_vals, known_binfos, + known_aggs, hints); } for (e = node->indirect_calls; e; e = e->next_callee) { fixes this and I cannot make sense of calling estimate_calls_size_and_time for the callee of an edge that we are not going to inline (or that is already inlined? I still find those if (e->inline_failed) checks odd). If it's supposed to account for inline bodies in the caller then we should have updated the inline_summary () of the caller, not have to recurse here - and we _do_ seem to (inline_merge_summary).