diff mbox series

[2/6] loop-iv: Add missing calls to `onlyjump_p'

Message ID alpine.LFD.2.21.2012031042291.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
Ignore jumps that have side effects in loop processing as pasting the 
body of a loop multiple times within is semantically equivalent to jump 
deletion (between the iterations unrolled) even if we do not physically 
delete the jump RTL insn.

	gcc/
	* loop-iv.c (simplify_using_initial_values): Only process jumps 
	that match `onlyjump_p'.
	(check_simple_exit): Likewise.
---
 gcc/loop-iv.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

gcc-loop-iv-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:
> Ignore jumps that have side effects in loop processing as pasting the 
> body of a loop multiple times within is semantically equivalent to jump 
> deletion (between the iterations unrolled) even if we do not physically 
> delete the jump RTL insn.
>
> 	gcc/
> 	* loop-iv.c (simplify_using_initial_values): Only process jumps 
> 	that match `onlyjump_p'.
> 	(check_simple_exit): Likewise.
OK
jeff
diff mbox series

Patch

Index: gcc/gcc/loop-iv.c
===================================================================
--- gcc.orig/gcc/loop-iv.c
+++ gcc/gcc/loop-iv.c
@@ -1936,7 +1936,7 @@  simplify_using_initial_values (class loo
   while (1)
     {
       insn = BB_END (e->src);
-      if (any_condjump_p (insn))
+      if (any_condjump_p (insn) && onlyjump_p (insn))
 	{
 	  rtx cond = get_condition (BB_END (e->src), NULL, false, true);
 
@@ -2887,7 +2887,7 @@  check_simple_exit (class loop *loop, edg
     return;
 
   /* It must end in a simple conditional jump.  */
-  if (!any_condjump_p (BB_END (exit_bb)))
+  if (!any_condjump_p (BB_END (exit_bb)) || !onlyjump_p (BB_END (exit_bb)))
     return;
 
   ein = EDGE_SUCC (exit_bb, 0);