public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838)
@ 2016-02-19 15:08 Jakub Jelinek
  2016-02-19 15:24 ` Dominik Vogt
  2016-02-19 16:17 ` Vladimir Makarov
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Jelinek @ 2016-02-19 15:08 UTC (permalink / raw)
  To: Vladimir Makarov; +Cc: gcc-patches, Dominik Vogt

Hi!

For -fnon-call-exceptions, if an instruction with REG_EH_REGION note is
reloaded, we should copy or move it to the instruction(s) corresponding to
the original one that could throw.  reload1.c apparently does this, but LRA
does not, so we can end up with REG_EH_REGION notes being dropped, or not
present on insns that actually can throw etc.

Fixed by calling the functions reload1.c does for this purpose.

Bootstrapped/regtested on x86_64-linux (including Ada) and i686-linux
(without Ada), and Dominik has kindly tested this on s390x-linux
(presumably with Ada, but don't know for sure).  Ok for trunk?

2016-02-19  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/69838
	* lra.c (lra_process_new_insns): If non-call exceptions are enabled,
	call copy_reg_eh_region_note_forward on before and/or after sequences
	and remove note from insn if it no longer can throw.

--- gcc/lra.c.jj	2016-01-04 14:55:52.000000000 +0100
+++ gcc/lra.c	2016-02-19 12:01:49.747724404 +0100
@@ -1742,20 +1742,29 @@ lra_process_new_insns (rtx_insn *insn, r
     }
   if (before != NULL_RTX)
     {
+      if (cfun->can_throw_non_call_exceptions)
+	copy_reg_eh_region_note_forward (insn, before, NULL);
       emit_insn_before (before, insn);
       push_insns (PREV_INSN (insn), PREV_INSN (before));
       setup_sp_offset (before, PREV_INSN (insn));
     }
   if (after != NULL_RTX)
     {
+      if (cfun->can_throw_non_call_exceptions)
+	copy_reg_eh_region_note_forward (insn, after, NULL);
       for (last = after; NEXT_INSN (last) != NULL_RTX; last = NEXT_INSN (last))
 	;
       emit_insn_after (after, insn);
       push_insns (last, insn);
       setup_sp_offset (after, last);
     }
+  if (cfun->can_throw_non_call_exceptions)
+    {
+      rtx note = find_reg_note (insn, REG_EH_REGION, NULL_RTX);
+      if (note && !insn_could_throw_p (insn))
+	remove_note (insn, note);
+    }
 }
-
 \f
 
 /* Replace all references to register OLD_REGNO in *LOC with pseudo

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838)
  2016-02-19 15:08 [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838) Jakub Jelinek
@ 2016-02-19 15:24 ` Dominik Vogt
  2016-02-19 16:17 ` Vladimir Makarov
  1 sibling, 0 replies; 3+ messages in thread
From: Dominik Vogt @ 2016-02-19 15:24 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Vladimir Makarov, gcc-patches

On Fri, Feb 19, 2016 at 04:08:37PM +0100, Jakub Jelinek wrote:
> For -fnon-call-exceptions, if an instruction with REG_EH_REGION note is
> reloaded, we should copy or move it to the instruction(s) corresponding to
> the original one that could throw.  reload1.c apparently does this, but LRA
> does not, so we can end up with REG_EH_REGION notes being dropped, or not
> present on insns that actually can throw etc.
> 
> Fixed by calling the functions reload1.c does for this purpose.
> 
> Bootstrapped/regtested on x86_64-linux (including Ada) and i686-linux
> (without Ada),

> and Dominik has kindly tested this on s390x-linux
> (presumably with Ada, but don't know for sure).

Yes, all languages with the whole testsuite.

Ciao

Dominik ^_^  ^_^

-- 

Dominik Vogt
IBM Germany

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838)
  2016-02-19 15:08 [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838) Jakub Jelinek
  2016-02-19 15:24 ` Dominik Vogt
@ 2016-02-19 16:17 ` Vladimir Makarov
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Makarov @ 2016-02-19 16:17 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Dominik Vogt

On 02/19/2016 10:08 AM, Jakub Jelinek wrote:
> Hi!
>
> For -fnon-call-exceptions, if an instruction with REG_EH_REGION note is
> reloaded, we should copy or move it to the instruction(s) corresponding to
> the original one that could throw.  reload1.c apparently does this, but LRA
> does not, so we can end up with REG_EH_REGION notes being dropped, or not
> present on insns that actually can throw etc.
>
> Fixed by calling the functions reload1.c does for this purpose.
>
> Bootstrapped/regtested on x86_64-linux (including Ada) and i686-linux
> (without Ada), and Dominik has kindly tested this on s390x-linux
> (presumably with Ada, but don't know for sure).  Ok for trunk?
>
>
Yes.  Thanks, Jakub.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-19 16:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-19 15:08 [PATCH] Fix up handling of REG_EH_REGION notes in LRA (PR middle-end/69838) Jakub Jelinek
2016-02-19 15:24 ` Dominik Vogt
2016-02-19 16:17 ` Vladimir Makarov

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).