[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-07-01 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

--- Comment #6 from Jeffrey A. Law  ---
And I'll confirm that m68k bootstrapped and regression tested.  The various
failures introduced by the 105231 change have all been fixed.  Thanks.

[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-06-29 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

Richard Biener  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Richard Biener  ---
Fixed.

[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-06-29 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Richard Biener :

https://gcc.gnu.org/g:0282c4acf720e4cc073cf95594aa890444c5ca82

commit r13-1342-g0282c4acf720e4cc073cf95594aa890444c5ca82
Author: Richard Biener 
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  

PR rtl-optimization/106082
* combine.cc (distribute_notes): Preserve notes when
they indicate a call doesn't perform a non-local goto.

[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-06-28 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

Richard Biener  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  ---
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 0x8000
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 i323: 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

[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-06-27 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |13.0
   Keywords||ice-checking,
   ||ice-on-valid-code

--- Comment #2 from Richard Biener  ---
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.

[Bug rtl-optimization/106082] [13 Regression] Recent change broke m68k

2022-06-24 Thread law at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106082

--- Comment #1 from Jeffrey A. Law  ---
/* { 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 ();
}