From 497742efce59a3296461199c16bbc520154d0e2e Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 19 Dec 2017 08:39:24 +0100 Subject: [PATCH] re PR tree-optimization/80631 (Compiling with -O3 -mavx2 gives wrong code) PR tree-optimization/80631 * tree-vect-loop.c (vect_create_epilog_for_reduction): Compare induc_code against MAX_EXPR or MIN_EXPR instead of reduc_fn against IFN_REDUC_MAX or IFN_REDUC_MIN. From-SVN: r255804 --- gcc/ChangeLog | 7 +++++++ gcc/tree-vect-loop.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96146e8934f..9f8b773d6b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-12-19 Jakub Jelinek + + PR tree-optimization/80631 + * tree-vect-loop.c (vect_create_epilog_for_reduction): Compare + induc_code against MAX_EXPR or MIN_EXPR instead of reduc_fn against + IFN_REDUC_MAX or IFN_REDUC_MIN. + 2017-12-18 Jeff Law * tree-ssa-dom.c (record_equivalences_from_phis): Do not diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index a66c8cfccad..58e46a0f4d3 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -4432,9 +4432,9 @@ vect_create_epilog_for_reduction (vec vect_defs, gimple *stmt, && (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) == INTEGER_INDUC_COND_REDUCTION) && !integer_zerop (induc_val) - && ((reduc_fn == IFN_REDUC_MAX + && ((induc_code == MAX_EXPR && tree_int_cst_lt (initial_def, induc_val)) - || (reduc_fn == IFN_REDUC_MIN + || (induc_code == MIN_EXPR && tree_int_cst_lt (induc_val, initial_def)))) induc_val = initial_def; vect_is_simple_use (initial_def, loop_vinfo, &def_stmt, &initial_def_dt); -- 2.30.2