From 164485b5c4f4fb74def017cf7e811c90435cc245 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 23 Jan 2018 00:00:50 +0100 Subject: [PATCH] re PR tree-optimization/83957 (ICE: Segmentation fault (in gimple_phi_arg)) PR tree-optimization/83957 * omp-expand.c (expand_omp_for_generic): Ignore virtual PHIs. Remove semicolon after for body surrounded by braces. * gcc.dg/autopar/pr83957.c: New test. From-SVN: r256967 --- gcc/ChangeLog | 4 ++++ gcc/omp-expand.c | 5 ++++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/autopar/pr83957.c | 11 +++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/autopar/pr83957.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d8c30e71916..507bb52dc82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2018-01-22 Jakub Jelinek + PR tree-optimization/83957 + * omp-expand.c (expand_omp_for_generic): Ignore virtual PHIs. Remove + semicolon after for body surrounded by braces. + PR tree-optimization/83081 * profile-count.h (profile_probability::split): New method. * dojump.c (do_jump_1) : diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 8690f863404..90e06310d81 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -3156,6 +3156,9 @@ expand_omp_for_generic (struct omp_region *region, gphi *nphi; gphi *exit_phi = psi.phi (); + if (virtual_operand_p (gimple_phi_result (exit_phi))) + continue; + edge l2_to_l3 = find_edge (l2_bb, l3_bb); tree exit_res = PHI_ARG_DEF_FROM_EDGE (exit_phi, l2_to_l3); @@ -3178,7 +3181,7 @@ expand_omp_for_generic (struct omp_region *region, add_phi_arg (nphi, exit_res, l2_to_l0, UNKNOWN_LOCATION); add_phi_arg (inner_phi, new_res, l0_to_l1, UNKNOWN_LOCATION); - }; + } } set_immediate_dominator (CDI_DOMINATORS, l2_bb, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23cef820eea..82497ed9641 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2018-01-22 Jakub Jelinek + PR tree-optimization/83957 + * gcc.dg/autopar/pr83957.c: New test. + PR tree-optimization/83081 * gcc.dg/predict-8.c: Adjust expected probability. diff --git a/gcc/testsuite/gcc.dg/autopar/pr83957.c b/gcc/testsuite/gcc.dg/autopar/pr83957.c new file mode 100644 index 00000000000..7d13ee19ce6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/autopar/pr83957.c @@ -0,0 +1,11 @@ +/* PR tree-optimization/83957 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -ftree-parallelize-loops=2 -fno-tree-dce --param parloops-schedule=dynamic" } */ + +void +foo (int *x, int y) +{ + if (y < 0) + for (; y < 1; ++y) + x = &y; +} -- 2.30.2