public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/strub)] fix latent bootstrap-debug issue Date: Fri, 20 Aug 2021 04:21:03 +0000 (GMT) [thread overview] Message-ID: <20210820042103.EA06D3892008@sourceware.org> (raw) https://gcc.gnu.org/g:ce6ec7df57712d53cbb40dee33cf1a6b30a149d5 commit ce6ec7df57712d53cbb40dee33cf1a6b30a149d5 Author: Alexandre Oliva <oliva@adacore.com> Date: Fri Aug 20 00:58:19 2021 -0300 fix latent bootstrap-debug issue I've hit a bootstrap-debug error involving large subprograms in gcc/ada/sem_ch12.adb. I'm afraid I couldn't narrow it down to a reasonable testcase. thread1 made different decisions about a block containing a builtin_eh_filter call because in one compilation, estimate_num_insns found a cgraph_node for the builtin and could thus get to the is_simple_builtin test, but in the other it didn't. With different insn counts, one stage jump-threaded and the other didn't, and the resulting code diverged quite a bit. The reason the builtin had a cgraph_node in one case but not the other was that modref got a chance to analyze the builtin call when it was the first stmt in the block, and that created the cgraph_node. However, when it was preceded by debug stmts, the loop in analyze_function was cut short after the first debug stmt, because the summary so far was not useful. This patch fixes both issues: skip debug stmts in the analyze_function loop, so as to prevent them from affecting any decisions in the loop, and enable the insn count estimator to get to the is_simple_builtin test when a cgraph_node has not been created for the builtin. for gcc/ChangeLog * ipa-modref.c (analyze_function): Skip debug stmts. * tree-inline.c (estimate_num_insn): Consider builtins even without a cgraph_node. Diff: --- gcc/ipa-modref.c | 3 ++- gcc/tree-inline.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index fafd804d4ba..f0cddbb077a 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -2108,7 +2108,8 @@ analyze_function (function *f, bool ipa) FOR_EACH_BB_FN (bb, f) { gimple_stmt_iterator si; - for (si = gsi_after_labels (bb); !gsi_end_p (si); gsi_next (&si)) + for (si = gsi_start_nondebug_after_labels_bb (bb); + !gsi_end_p (si); gsi_next_nondebug (&si)) { if (!analyze_stmt (summary, summary_lto, gsi_stmt (si), ipa, &recursive_calls) diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index d0e9f52d5f1..636130fe001 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4436,8 +4436,8 @@ estimate_num_insns (gimple *stmt, eni_weights *weights) /* Do not special case builtins where we see the body. This just confuse inliner. */ struct cgraph_node *node; - if (!(node = cgraph_node::get (decl)) - || node->definition) + if ((node = cgraph_node::get (decl)) + && node->definition) ; /* For buitins that are likely expanded to nothing or inlined do not account operand costs. */
reply other threads:[~2021-08-20 4:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210820042103.EA06D3892008@sourceware.org \ --to=aoliva@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).