diff mbox series

[1/6] ifcvt: Add missing call to `onlyjump_p'

Message ID alpine.LFD.2.21.2012031017290.656242@eddie.linux-mips.org
State Accepted
Headers show
Series Add missing calls to `onlyjump_p' | expand

Commit Message

Maciej W. Rozycki Dec. 3, 2020, 11:34 a.m. UTC
Do not convert a conditional jump into conditional execution (and remove 
the jump as a consequence) if the jump has side effects.

	gcc/
	* ifcvt.c (dead_or_predicable) [!IFCVT_MODIFY_TESTS]: Bail out 
	if `!onlyjump_p'.
---
 gcc/ifcvt.c |    6 ++++++
 1 file changed, 6 insertions(+)

gcc-ifcvt-dead-or-predicable-ce-only-jump.diff

Comments

Jeff Law Dec. 3, 2020, 10:02 p.m. UTC | #1
On 12/3/20 4:34 AM, Maciej W. Rozycki wrote:
> Do not convert a conditional jump into conditional execution (and remove 
> the jump as a consequence) if the jump has side effects.
>
> 	gcc/
> 	* ifcvt.c (dead_or_predicable) [!IFCVT_MODIFY_TESTS]: Bail out 
> 	if `!onlyjump_p'.
OK
jeff
> ---
>  gcc/ifcvt.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> gcc-ifcvt-dead-or-predicable-ce-only-jump.diff
> Index: gcc/gcc/ifcvt.c
> ===================================================================
> --- gcc.orig/gcc/ifcvt.c
> +++ gcc/gcc/ifcvt.c
> @@ -5127,6 +5127,11 @@ dead_or_predicable (basic_block test_bb,
>  
>        rtx cond;
>  
> +      /* If the conditional jump is more than just a conditional jump,
> +	 then we cannot do conditional execution conversion on this block.  */
> +      if (!onlyjump_p (jump))
> +	goto nce;
> +
>        cond = cond_exec_get_condition (jump);
>        if (! cond)
>  	return FALSE;
> @@ -5154,6 +5159,7 @@ dead_or_predicable (basic_block test_bb,
>  
>        earliest = jump;
>      }
> + nce:
>  #endif
>  
>    /* If we allocated new pseudos (e.g. in the conditional move
>
diff mbox series

Patch

Index: gcc/gcc/ifcvt.c
===================================================================
--- gcc.orig/gcc/ifcvt.c
+++ gcc/gcc/ifcvt.c
@@ -5127,6 +5127,11 @@  dead_or_predicable (basic_block test_bb,
 
       rtx cond;
 
+      /* If the conditional jump is more than just a conditional jump,
+	 then we cannot do conditional execution conversion on this block.  */
+      if (!onlyjump_p (jump))
+	goto nce;
+
       cond = cond_exec_get_condition (jump);
       if (! cond)
 	return FALSE;
@@ -5154,6 +5159,7 @@  dead_or_predicable (basic_block test_bb,
 
       earliest = jump;
     }
+ nce:
 #endif
 
   /* If we allocated new pseudos (e.g. in the conditional move