* [PATCH] [tree-prof] skip if errors were seen [PR113681]
@ 2024-03-09 9:11 Alexandre Oliva
2024-03-22 18:10 ` Jeff Law
0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Oliva @ 2024-03-09 9:11 UTC (permalink / raw)
To: gcc-patches
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.
Regstrapped on x86_64-linux-gnu. Ok to install?
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.
---
gcc/testsuite/c-c++-common/strub-pr113681.c | 22 ++++++++++++++++++++++
gcc/tree-profile.cc | 3 ++-
2 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/c-c++-common/strub-pr113681.c
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 0000000000000..3ef9017b2eb70
--- /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 aed13e2b1bc30..d2bdbe3a08c2f 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
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [tree-prof] skip if errors were seen [PR113681]
2024-03-09 9:11 [PATCH] [tree-prof] skip if errors were seen [PR113681] Alexandre Oliva
@ 2024-03-22 18:10 ` Jeff Law
2024-03-29 19:38 ` Alexandre Oliva
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Law @ 2024-03-22 18:10 UTC (permalink / raw)
To: Alexandre Oliva, gcc-patches
On 3/9/24 2:11 AM, Alexandre Oliva wrote:
>
> 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.
>
> Regstrapped on x86_64-linux-gnu. Ok to install?
>
>
> 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.
So I've really never dug into strub, but this would seem to imply that
an error from strub is non-fatal? Are we going to end up having to
make a similar change to gate most passes if strub let's things to
forward rather than causing a graceful exit?
jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [tree-prof] skip if errors were seen [PR113681]
2024-03-22 18:10 ` Jeff Law
@ 2024-03-29 19:38 ` Alexandre Oliva
2024-04-16 4:03 ` Alexandre Oliva
0 siblings, 1 reply; 6+ messages in thread
From: Alexandre Oliva @ 2024-03-29 19:38 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On Mar 22, 2024, Jeff Law <jeffreyalaw@gmail.com> wrote:
> On 3/9/24 2:11 AM, Alexandre Oliva wrote:
>> 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.
>> Regstrapped on x86_64-linux-gnu. Ok to install?
>>
>> 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.
> So I've really never dug into strub, but this would seem to imply that
> an error from strub is non-fatal?
Yeah. I believe that's no different from other passes.
Various other passes have seen_errors guards, but ipa-prof didn't.
I suppose the insertion point for the strubm pass was one where others
passes didn't previously issue errors, so that wasn't an issue for
ipa-prof. But now it is.
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [tree-prof] skip if errors were seen [PR113681]
2024-03-29 19:38 ` Alexandre Oliva
@ 2024-04-16 4:03 ` Alexandre Oliva
2024-05-25 8:22 ` Alexandre Oliva
2024-06-09 1:53 ` Jeff Law
0 siblings, 2 replies; 6+ messages in thread
From: Alexandre Oliva @ 2024-04-16 4:03 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On Mar 29, 2024, Alexandre Oliva <oliva@adacore.com> wrote:
> On Mar 22, 2024, Jeff Law <jeffreyalaw@gmail.com> wrote:
>> On 3/9/24 2:11 AM, Alexandre Oliva wrote:
>>> 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.
>>> Regstrapped on x86_64-linux-gnu. Ok to install?
>>>
>>> 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.
>> So I've really never dug into strub, but this would seem to imply that
>> an error from strub is non-fatal?
> Yeah. I believe that's no different from other passes.
> Various other passes have seen_errors guards, but ipa-prof didn't.
Specifically, pass_build_ssa_passes in passes.cc is gated with
!seen_errors(), so we skip all the passes bundled in it, and don't
advance the symtab state to IPA_SSA. So other passes that would require
IPA_SSA need to be gated similarly.
> I suppose the insertion point for the strubm pass was one where others
> passes didn't previously issue errors, so that wasn't an issue for
> ipa-prof. But now it is.
The patch needed adjustments to resolve conflicts with unrelated
changes.
[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.
Regstrapped on x86_64-linux-gnu. Ok to install?
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.
---
gcc/testsuite/c-c++-common/strub-pr113681.c | 22 ++++++++++++++++++++++
gcc/tree-profile.cc | 3 ++-
2 files changed, 24 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/c-c++-common/strub-pr113681.c
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 0000000000000..3ef9017b2eb70
--- /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 b87c121790c99..e4bb689cef589 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
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [tree-prof] skip if errors were seen [PR113681]
2024-04-16 4:03 ` Alexandre Oliva
@ 2024-05-25 8:22 ` Alexandre Oliva
2024-06-09 1:53 ` Jeff Law
1 sibling, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 2024-05-25 8:22 UTC (permalink / raw)
To: Jeff Law; +Cc: gcc-patches
On Apr 16, 2024, Alexandre Oliva <oliva@adacore.com> wrote:
> 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.
Ping? https://gcc.gnu.org/pipermail/gcc-patches/2024-April/649546.html
--
Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/
Free Software Activist GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [tree-prof] skip if errors were seen [PR113681]
2024-04-16 4:03 ` Alexandre Oliva
2024-05-25 8:22 ` Alexandre Oliva
@ 2024-06-09 1:53 ` Jeff Law
1 sibling, 0 replies; 6+ messages in thread
From: Jeff Law @ 2024-06-09 1:53 UTC (permalink / raw)
To: Alexandre Oliva; +Cc: gcc-patches
On 4/15/24 10:03 PM, Alexandre Oliva wrote:
> On Mar 29, 2024, Alexandre Oliva <oliva@adacore.com> wrote:
>
>> On Mar 22, 2024, Jeff Law <jeffreyalaw@gmail.com> wrote:
>>> On 3/9/24 2:11 AM, Alexandre Oliva wrote:
>>>> 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.
>>>> Regstrapped on x86_64-linux-gnu. Ok to install?
>>>>
>>>> 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.
>>> So I've really never dug into strub, but this would seem to imply that
>>> an error from strub is non-fatal?
>
>> Yeah. I believe that's no different from other passes.
>
>> Various other passes have seen_errors guards, but ipa-prof didn't.
>
> Specifically, pass_build_ssa_passes in passes.cc is gated with
> !seen_errors(), so we skip all the passes bundled in it, and don't
> advance the symtab state to IPA_SSA. So other passes that would require
> IPA_SSA need to be gated similarly.
>
>> I suppose the insertion point for the strubm pass was one where others
>> passes didn't previously issue errors, so that wasn't an issue for
>> ipa-prof. But now it is.
>
> The patch needed adjustments to resolve conflicts with unrelated
> changes.
>
>
> [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.
>
> Regstrapped on x86_64-linux-gnu. Ok to install?
>
>
> 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.
OK.
jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-09 1:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-09 9:11 [PATCH] [tree-prof] skip if errors were seen [PR113681] Alexandre Oliva
2024-03-22 18:10 ` Jeff Law
2024-03-29 19:38 ` Alexandre Oliva
2024-04-16 4:03 ` Alexandre Oliva
2024-05-25 8:22 ` Alexandre Oliva
2024-06-09 1:53 ` Jeff Law
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).