public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFA] PR rtl-optimization/66237
@ 2015-05-22  8:33 Mikhail Maltsev
  2015-05-22 20:38 ` Jeff Law
  0 siblings, 1 reply; 2+ messages in thread
From: Mikhail Maltsev @ 2015-05-22  8:33 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 422 bytes --]

This patch fixes a bug introduced by refactoring. A cast from rtx_insn
to rtx_jump_insn in fix_crossing_conditional_branches was placed before
the check, and that caused ICE if the instruction is actually a call,
rather than a jump.

Bootstrapped/regtested on x86_64 linux and tested the regressed case
(PR34999) on aarch64 crosscompiler using the provided profiling data.

OK for trunk?

-- 
Regards,
    Mikhail Maltsev

[-- Attachment #2: pr66237.clog --]
[-- Type: text/plain, Size: 187 bytes --]

gcc/ChangeLog:

2015-05-22  Mikhail Maltsev  <maltsevm@gmail.com>

	PR rtl-optimization/66237
	* bb-reorder.c (fix_crossing_conditional_branches): Fix wrong
	location of an "as_a" cast.


[-- Attachment #3: pr66237.patch --]
[-- Type: text/plain, Size: 1434 bytes --]

diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 20e15fc..cbf6343 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2044,7 +2044,7 @@ fix_crossing_conditional_branches (void)
 
       if (crossing_edge)
 	{
-	  rtx_jump_insn *old_jump = as_a <rtx_jump_insn *> (BB_END (cur_bb));
+	  rtx_insn *old_jump = BB_END (cur_bb);
 
 	  /* Check to make sure the jump instruction is a
 	     conditional jump.  */
@@ -2067,6 +2067,9 @@ fix_crossing_conditional_branches (void)
 
 	  if (set_src && (GET_CODE (set_src) == IF_THEN_ELSE))
 	    {
+	      rtx_jump_insn *old_jump_insn =
+			as_a <rtx_jump_insn *> (old_jump);
+
 	      if (GET_CODE (XEXP (set_src, 1)) == PC)
 		old_label = XEXP (set_src, 2);
 	      else if (GET_CODE (XEXP (set_src, 2)) == PC)
@@ -2095,7 +2098,7 @@ fix_crossing_conditional_branches (void)
 		  emit_label (new_label);
 
 		  gcc_assert (GET_CODE (old_label) == LABEL_REF);
-		  old_jump_target = old_jump->jump_target ();
+		  old_jump_target = old_jump_insn->jump_target ();
 		  new_jump = as_a <rtx_jump_insn *>
 				(emit_jump_insn (gen_jump (old_jump_target)));
 		  new_jump->set_jump_target (old_jump_target);
@@ -2114,7 +2117,7 @@ fix_crossing_conditional_branches (void)
 
 	      /* Make old jump branch to new bb.  */
 
-	      redirect_jump (old_jump, new_label, 0);
+	      redirect_jump (old_jump_insn, new_label, 0);
 
 	      /* Remove crossing_edge as predecessor of 'dest'.  */
 

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

* Re: [PATCH][RFA] PR rtl-optimization/66237
  2015-05-22  8:33 [PATCH][RFA] PR rtl-optimization/66237 Mikhail Maltsev
@ 2015-05-22 20:38 ` Jeff Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2015-05-22 20:38 UTC (permalink / raw)
  To: Mikhail Maltsev, gcc-patches

On 05/22/2015 02:27 AM, Mikhail Maltsev wrote:
> This patch fixes a bug introduced by refactoring. A cast from rtx_insn
> to rtx_jump_insn in fix_crossing_conditional_branches was placed before
> the check, and that caused ICE if the instruction is actually a call,
> rather than a jump.
>
> Bootstrapped/regtested on x86_64 linux and tested the regressed case
> (PR34999) on aarch64 crosscompiler using the provided profiling data.
>
> OK for trunk?
>
> -- Regards, Mikhail Maltsev
>
>
> pr66237.clog
>
>
> gcc/ChangeLog:
>
> 2015-05-22  Mikhail Maltsev<maltsevm@gmail.com>
>
> 	PR rtl-optimization/66237
> 	* bb-reorder.c (fix_crossing_conditional_branches): Fix wrong
> 	location of an "as_a" cast.
OK.
jeff

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

end of thread, other threads:[~2015-05-22 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-22  8:33 [PATCH][RFA] PR rtl-optimization/66237 Mikhail Maltsev
2015-05-22 20:38 ` 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).