public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k
@ 2022-06-24 21:42 law at gcc dot gnu.org
2022-06-24 21:42 ` [Bug rtl-optimization/106082] " law at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2022-06-24 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
Bug ID: 106082
Summary: [13 Regression] Recent change broke m68k
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: law at gcc dot gnu.org
Target Milestone: ---
Target: m68k
This change:
commit 4f77738c3b44cb6b7bfe2a7ef823a5d9d75c0e79 (HEAD, refs/bisect/bad)
Author: Richard Biener <rguenther@suse.de>
Date: Thu Apr 14 14:06:22 2022 +0200
rtl-optimization/105231 - distribute_notes and REG_EH_REGION
The following mitigates a problem in combine distribute_notes which
places an original REG_EH_REGION based on only may_trap_p which is
good to test whether a non-call insn can possibly throw but not if
actually it does or we care. That's something we decided at RTL
expansion time where we possibly still know the insn evaluates
to a constant.
In fact, the REG_EH_REGION note with lp > 0 can only come from the
original i3 and an assert is added to that effect. That means we only
need to retain the note on i3 or, if that cannot trap, drop it but we
should never move it to i2.
The following places constraints on the insns to combine with
non-call exceptions since we cannot handle the case where we
have more than one EH side-effect in the IL. The patch also
makes sure we can accumulate that on i3 and do not split
a possible exception raising part of it to i2. As a special
case we do not place any restriction on all externally
throwing insns when there is no REG_EH_REGION present.
2022-04-22 Richard Biener <rguenther@suse.de>
PR rtl-optimization/105231
* combine.cc (distribute_notes): Assert that a REG_EH_REGION
with landing pad > 0 is from i3. Put any REG_EH_REGION note
on i3 or drop it if the insn can not trap.
(try_combine): Ensure that we can merge REG_EH_REGION notes
with non-call exceptions. Ensure we are not splitting a
trapping part of an insn with non-call exceptions when there
is any REG_EH_REGION note to preserve.
* gcc.dg/torture/pr105231.c: New testcase.
Broke various tests on the m68k. This is from nested-func-5.c:
./xgcc -B./ -O2 j.c -c
j.c: In function ‘recursive’:
j.c:28:1: error: in basic block 2:
28 | }
| ^
j.c:28:1: error: flow control insn inside a basic block
(call_insn 23 22 24 2 (call (mem:QI (symbol_ref:SI ("__clear_cache")) [0 S1
A8])
(const_int 8 [0x8])) "j.c":6:13 406 {*call}
(expr_list:REG_CALL_DECL (symbol_ref:SI ("__clear_cache"))
(nil))
(expr_list (use (mem:SI (plus:SI (reg/f:SI 15 %sp)
(scratch:SI)) [0 S4 A8]))
(nil)))
during RTL pass: combine
j.c:28:1: internal compiler error: in rtl_verify_bb_insns, at cfgrtl.cc:2797
This can be seen with a m68k-linux-gnu cross compiler.
Sorry I took so long to report this. I'd assumed the failures were a result of
the binutils work which started warning for bogus rwx segments which happened
about the same time.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
@ 2022-06-24 21:42 ` law at gcc dot gnu.org
2022-06-27 9:04 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2022-06-24 21:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
--- Comment #1 from Jeffrey A. Law <law at gcc dot gnu.org> ---
/* { dg-require-effective-target trampolines } */
extern void abort (void);
extern void exit (int);
static void recursive (int n, void (*proc) (void))
{
__label__ l1;
void do_goto (void)
{
goto l1;
}
if (n == 3)
recursive (n - 1, do_goto);
else if (n > 0)
recursive (n - 1, proc);
else
(*proc) ();
return;
l1:
if (n == 3)
exit (0);
else
abort ();
}
int main ()
{
recursive (10, abort);
abort ();
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
2022-06-24 21:42 ` [Bug rtl-optimization/106082] " law at gcc dot gnu.org
@ 2022-06-27 9:04 ` rguenth at gcc dot gnu.org
2022-06-28 11:08 ` rguenth at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-27 9:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
Keywords| |ice-checking,
| |ice-on-valid-code
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Not sure if I am qualified to look but if there's a problematical
distribute_notes operation then the guards in try_combine need amending.
Maybe __clear_cache is somehow wrongly annotated.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
2022-06-24 21:42 ` [Bug rtl-optimization/106082] " law at gcc dot gnu.org
2022-06-27 9:04 ` rguenth at gcc dot gnu.org
@ 2022-06-28 11:08 ` rguenth at gcc dot gnu.org
2022-06-29 12:00 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-28 11:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
Blocks| |105231
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2022-06-28
Ever confirmed|0 |1
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the call_insn satisfies can_nonlocal_goto () because we did
Trying 22 -> 23:
22: r41:SI=`__clear_cache'
23: call [r41:SI] argc:0x8
REG_DEAD r41:SI
REG_EH_REGION 0xffffffff80000000
Successfully matched this instruction:
(call (mem:QI (symbol_ref:SI ("__clear_cache")) [0 S1 A8])
(const_int 8 [0x8]))
allowing combination of insns 22 and 23
original costs 3 + 0 = 0
replacement cost 0
deferring deletion of insn with uid = 22.
modifying insn i3 23: call [`__clear_cache'] argc:0x8
deferring rescan insn with uid = 23.
I have a fix.
diff --git a/gcc/combine.cc b/gcc/combine.cc
index a8305273e44..3d34e860cf9 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -14218,8 +14218,10 @@ distribute_notes (rtx notes, rtx_insn *from_insn,
rtx_insn *i3, rtx_insn *i2,
gcc_assert (from_insn == i3);
/* We are making sure there is a single effective REG_EH_REGION
note and it's valid to put it on i3. */
- if (!insn_could_throw_p (from_insn))
- /* Throw away stra notes on insns that can never throw. */
+ if (!insn_could_throw_p (from_insn)
+ && (lp_nr != INT_MIN || !can_nonlocal_goto (from_insn)))
+ /* Throw away stray notes on insns that can never throw or
+ make a nonlocal goto. */
;
else
{
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105231
[Bug 105231] [12 Regression] ICE: in rtl_verify_bb_insns, at cfgrtl.cc:2797
(flow control insn inside a basic block) with custom flags since
r12-4767-g81342e95827f77c0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
` (2 preceding siblings ...)
2022-06-28 11:08 ` rguenth at gcc dot gnu.org
@ 2022-06-29 12:00 ` cvs-commit at gcc dot gnu.org
2022-06-29 12:00 ` rguenth at gcc dot gnu.org
2022-07-01 14:33 ` law at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-29 12:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:0282c4acf720e4cc073cf95594aa890444c5ca82
commit r13-1342-g0282c4acf720e4cc073cf95594aa890444c5ca82
Author: Richard Biener <rguenther@suse.de>
Date: Tue Jun 28 13:08:33 2022 +0200
rtl-optimization/106082 - preserve EH note for no non-local goto
The following makes sure we preserve EH notes on call insns that
indicate the call doesn't perform a non-local goto when distributing
notes after combining insns.
2022-06-28 Richard Biener <rguenther@suse.de>
PR rtl-optimization/106082
* combine.cc (distribute_notes): Preserve notes when
they indicate a call doesn't perform a non-local goto.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
` (3 preceding siblings ...)
2022-06-29 12:00 ` cvs-commit at gcc dot gnu.org
@ 2022-06-29 12:00 ` rguenth at gcc dot gnu.org
2022-07-01 14:33 ` law at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-29 12:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
` (4 preceding siblings ...)
2022-06-29 12:00 ` rguenth at gcc dot gnu.org
@ 2022-07-01 14:33 ` law at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: law at gcc dot gnu.org @ 2022-07-01 14:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082
--- Comment #6 from Jeffrey A. Law <law at gcc dot gnu.org> ---
And I'll confirm that m68k bootstrapped and regression tested. The various
failures introduced by the 105231 change have all been fixed. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-07-01 14:33 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 21:42 [Bug rtl-optimization/106082] New: [13 Regression] Recent change broke m68k law at gcc dot gnu.org
2022-06-24 21:42 ` [Bug rtl-optimization/106082] " law at gcc dot gnu.org
2022-06-27 9:04 ` rguenth at gcc dot gnu.org
2022-06-28 11:08 ` rguenth at gcc dot gnu.org
2022-06-29 12:00 ` cvs-commit at gcc dot gnu.org
2022-06-29 12:00 ` rguenth at gcc dot gnu.org
2022-07-01 14:33 ` law at gcc dot gnu.org
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).