tree-optimization/104716 - check if we can copy loop in loop distribution
The following checks whether we can copy the loop before attempting to do so in loop distribution. In the testcase there's a computed goto and thus abnormal edges which we cannot redirect. 2022-03-01 Richard Biener <rguenther@suse.de> PR tree-optimization/104716 * tree-loop-distribution.cc (find_seed_stmts_for_distribution): Check if we can copy the loop. * gfortran.dg/pr104716.f: New testcase.
This commit is contained in:
parent
8fba8a8c26
commit
54ef95cc4d
31
gcc/testsuite/gfortran.dg/pr104716.f
Normal file
31
gcc/testsuite/gfortran.dg/pr104716.f
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
! { dg-do compile }
|
||||||
|
! { dg-options "-std=legacy -O2 -ftree-loop-distribution -fno-move-loop-stores -fno-tree-dominator-opts" }
|
||||||
|
|
||||||
|
SUBROUTINE FOO()
|
||||||
|
|
||||||
|
COMMON /WORK/ C2(2, 2)
|
||||||
|
|
||||||
|
DIMENSION D11(2)
|
||||||
|
|
||||||
|
EQUIVALENCE (D11(1), C2(1, 1))
|
||||||
|
|
||||||
|
DO 40 I = 1, 2
|
||||||
|
DO 30 J = 1, 2
|
||||||
|
ASSIGN 10 TO ILBL
|
||||||
|
IF (C2(J, I) .NE. 0.0) THEN
|
||||||
|
ASSIGN 20 TO ILBL
|
||||||
|
ENDIF
|
||||||
|
GO TO ILBL
|
||||||
|
10 CONTINUE
|
||||||
|
20 CONTINUE
|
||||||
|
C2(J, I) = C2(J, I) + 1
|
||||||
|
30 CONTINUE
|
||||||
|
40 CONTINUE
|
||||||
|
|
||||||
|
DO 50 I = 1, 2
|
||||||
|
PRINT 90, I
|
||||||
|
50 CONTINUE
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
90 FORMAT(I5)
|
||||||
|
END
|
@ -3277,8 +3277,15 @@ find_seed_stmts_for_distribution (class loop *loop, vec<gimple *> *work_list)
|
|||||||
work_list->safe_push (stmt);
|
work_list->safe_push (stmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
bool res = work_list->length () > 0;
|
||||||
|
if (res && !can_copy_bbs_p (bbs, loop->num_nodes))
|
||||||
|
{
|
||||||
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
||||||
|
fprintf (dump_file, "cannot copy loop %d.\n", loop->num);
|
||||||
|
res = false;
|
||||||
|
}
|
||||||
free (bbs);
|
free (bbs);
|
||||||
return work_list->length () > 0;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A helper function for generate_{rawmemchr,strlen}_builtin functions in order
|
/* A helper function for generate_{rawmemchr,strlen}_builtin functions in order
|
||||||
|
Loading…
Reference in New Issue
Block a user