diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-07-28 09:11:51 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-07-28 09:11:51 +0200 |
commit | d0ee55a1f7ce56b20e9d52904da026a316241930 (patch) | |
tree | 77c6765ddf61786720242bb3a9d02a72472e690f /gcc/tree-parloops.c | |
parent | 1ce75e415688d0f0bec52cdd8d0fcdaccb5efac5 (diff) |
re PR tree-optimization/81578 (ICE in omp_reduction_init_op)
PR tree-optimization/81578
* tree-parloops.c (build_new_reduction): Bail out if
reduction_code isn't one of the standard OpenMP reductions.
Move the details printing after that decision.
* gcc.dg/pr81578.c: New test.
From-SVN: r250651
Diffstat (limited to 'gcc/tree-parloops.c')
-rw-r--r-- | gcc/tree-parloops.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index 470964bebf7..538932e50bf 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -2475,23 +2475,39 @@ build_new_reduction (reduction_info_table_type *reduction_list, gcc_assert (reduc_stmt); - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, - "Detected reduction. reduction stmt is:\n"); - print_gimple_stmt (dump_file, reduc_stmt, 0); - fprintf (dump_file, "\n"); - } - if (gimple_code (reduc_stmt) == GIMPLE_PHI) { tree op1 = PHI_ARG_DEF (reduc_stmt, 0); gimple *def1 = SSA_NAME_DEF_STMT (op1); reduction_code = gimple_assign_rhs_code (def1); } - else reduction_code = gimple_assign_rhs_code (reduc_stmt); + /* Check for OpenMP supported reduction. */ + switch (reduction_code) + { + case PLUS_EXPR: + case MULT_EXPR: + case MAX_EXPR: + case MIN_EXPR: + case BIT_IOR_EXPR: + case BIT_XOR_EXPR: + case BIT_AND_EXPR: + case TRUTH_OR_EXPR: + case TRUTH_XOR_EXPR: + case TRUTH_AND_EXPR: + break; + default: + return; + } + + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, + "Detected reduction. reduction stmt is:\n"); + print_gimple_stmt (dump_file, reduc_stmt, 0); + fprintf (dump_file, "\n"); + } new_reduction = XCNEW (struct reduction_info); |