From d83cc5ccf7de9cd55a2f50c994e20e97404514dc Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 19 Jul 2017 06:25:40 +0000 Subject: [PATCH] Handle equal-argument loop exit phi in expand_omp_for_static_chunk 2017-07-18 Tom de Vries PR middle-end/81464 * omp-expand.c (expand_omp_for_static_chunk): Handle equal-argument loop exit phi. * gfortran.dg/pr81464.f90: New test. From-SVN: r250335 --- gcc/ChangeLog | 6 ++++++ gcc/omp-expand.c | 4 ++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr81464.f90 | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr81464.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ef0e7881073..54e78a62dbf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-07-18 Tom de Vries + + PR middle-end/81464 + * omp-expand.c (expand_omp_for_static_chunk): Handle equal-argument loop + exit phi. + 2017-07-18 Uros Bizjak PR target/81471 diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 929c53078d5..d6755cd71ee 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -4206,6 +4206,10 @@ expand_omp_for_static_chunk (struct omp_region *region, source_location locus; phi = psi.phi (); + if (operand_equal_p (gimple_phi_arg_def (phi, 0), + redirect_edge_var_map_def (vm), 0)) + continue; + t = gimple_phi_result (phi); gcc_assert (t == redirect_edge_var_map_result (vm)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1929d15be82..4687e45d36c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-18 Tom de Vries + + PR middle-end/81464 + * gfortran.dg/pr81464.f90: New test. + 2017-07-18 Uros Bizjak PR target/81471 diff --git a/gcc/testsuite/gfortran.dg/pr81464.f90 b/gcc/testsuite/gfortran.dg/pr81464.f90 new file mode 100644 index 00000000000..425cae9470c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr81464.f90 @@ -0,0 +1,19 @@ +! { dg-do compile } +! { dg-options "--param parloops-chunk-size=2 -ftree-parallelize-loops=2 -O1" } + +program main + implicit none + real, dimension(:,:),allocatable :: a, b, c + real :: sm + + allocate (a(2,2), b(2,2), c(2,2)) + + call random_number(a) + call random_number(b) + + c = matmul(a,b) + sm = sum(c) + + deallocate(a,b,c) + +end program main -- 2.30.2