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/testme)] [tree-prof] skip if errors were seen [PR113681]
Date: Wed, 29 May 2024 06:59:16 +0000 (GMT)	[thread overview]
Message-ID: <20240529065916.2E6B73870C09@sourceware.org> (raw)

https://gcc.gnu.org/g:1c340408045fdf647edca445e40a75b09bce7493

commit 1c340408045fdf647edca445e40a75b09bce7493
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Wed May 29 02:52:23 2024 -0300

    [tree-prof] skip if errors were seen [PR113681]
    
    ipa_tree_profile asserts that the symtab is in IPA_SSA state, but we
    don't reach that state and ICE if e.g. ipa-strub passes report errors.
    Skip this pass if errors were seen.
    
    
    for  gcc/ChangeLog
    
            PR tree-optimization/113681
            * tree-profiling.cc (pass_ipa_tree_profile::gate): Skip if
            seen_errors.
    
    for  gcc/testsuite/ChangeLog
    
            PR tree-optimization/113681
            * c-c++-common/strub-pr113681.c: New.

Diff:
---
 gcc/testsuite/c-c++-common/strub-pr113681.c | 22 ++++++++++++++++++++++
 gcc/tree-profile.cc                         |  3 ++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/c-c++-common/strub-pr113681.c b/gcc/testsuite/c-c++-common/strub-pr113681.c
new file mode 100644
index 00000000000..3ef9017b2eb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/strub-pr113681.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-options "-fstrub=relaxed -fbranch-probabilities" } */
+/* { dg-require-effective-target strub } */
+
+/* Same as torture/strub-inlineable1.c, but with -fbranch-probabilities, to
+   check that IPA tree-profiling won't ICE.  It would when we refrained from
+   running passes that would take it to IPA_SSA, but ran the pass that asserted
+   for IPA_SSA.  */
+
+inline void __attribute__ ((strub ("internal"), always_inline))
+inl_int_ali (void)
+{
+  /* No internal wrapper, so this body ALWAYS gets inlined,
+     but it cannot be called from non-strub contexts.  */
+}
+
+void
+bat (void)
+{
+  /* Not allowed, not a strub context.  */
+  inl_int_ali (); /* { dg-error "context" } */
+}
diff --git a/gcc/tree-profile.cc b/gcc/tree-profile.cc
index b87c121790c..e4bb689cef5 100644
--- a/gcc/tree-profile.cc
+++ b/gcc/tree-profile.cc
@@ -2070,7 +2070,8 @@ pass_ipa_tree_profile::gate (function *)
      disabled.  */
   return (!in_lto_p && !flag_auto_profile
 	  && (flag_branch_probabilities || flag_test_coverage
-	      || profile_arc_flag || condition_coverage_flag));
+	      || profile_arc_flag || condition_coverage_flag)
+	  && !seen_error ());
 }
 
 } // anon namespace

             reply	other threads:[~2024-05-29  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  6:59 Alexandre Oliva [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-08 16:35 Alexandre Oliva

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=20240529065916.2E6B73870C09@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: link
Be 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).