From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 9BB91385DC3E; Fri, 8 Mar 2024 16:35:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9BB91385DC3E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709915713; bh=uviAeL/BeAc6+91Yhndv+GMd7FJIkEuT62k/YmbfqYs=; h=From:To:Subject:Date:From; b=FZPBYlIE3q+iF7Zd5iHCZmEGZ/46K0OsEME3HkUPswu//USfcP15v7qqSC6rF9yku berGVep8ZFpQ3Zj/rvdwzqHKVCiKl2/Nqa6jUx5tIqfw7HJAwWs5oDbYIvfGeqnena ZxnpgmLDrweBCLxIpQGvnTA5eVabkpJH/Wgkz2q8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [tree-prof] skip if errors were seen [PR113681] X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: e74e6e4f783b7aecd712e36b996174ac78f19185 X-Git-Newrev: a2b5748ee9fd2e254ec9bda4bca0d5224e9abd6e Message-Id: <20240308163513.9BB91385DC3E@sourceware.org> Date: Fri, 8 Mar 2024 16:35:13 +0000 (GMT) List-Id: https://gcc.gnu.org/g:a2b5748ee9fd2e254ec9bda4bca0d5224e9abd6e commit a2b5748ee9fd2e254ec9bda4bca0d5224e9abd6e Author: Alexandre Oliva Date: Fri Mar 8 12:26:43 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 aed13e2b1bc..d2bdbe3a08c 100644 --- a/gcc/tree-profile.cc +++ b/gcc/tree-profile.cc @@ -999,7 +999,8 @@ pass_ipa_tree_profile::gate (function *) disabled. */ return (!in_lto_p && !flag_auto_profile && (flag_branch_probabilities || flag_test_coverage - || profile_arc_flag)); + || profile_arc_flag) + && !seen_error ()); } } // anon namespace