From efc3a1a101184a73718bcb034e530e57cd65a543 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 27 Aug 2018 14:17:03 +0000 Subject: [PATCH] re PR tree-optimization/86927 (Gcc miscompiles at -O3 on valid code) 2018-08-27 Richard Biener PR tree-optimization/86927 * tree-vect-loop.c (vect_create_epilog_for_reduction): Properly use const cond reduction code. * gcc.dg/vect/pr86927.c: New testcase. From-SVN: r263888 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr86927.c | 15 +++++++++++++++ gcc/tree-vect-loop.c | 3 +++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr86927.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 123d76c8680..d27a7a8d78c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-08-27 Richard Biener + + PR tree-optimization/86927 + * tree-vect-loop.c (vect_create_epilog_for_reduction): Properly + use const cond reduction code. + 2018-08-27 Alexander Monakov PR tree-optimization/85758 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa957ee561b..8ebadb04e87 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-27 Richard Biener + + PR tree-optimization/86927 + * gcc.dg/vect/pr86927.c: New testcase. + 2018-08-27 David Malcolm PR 87091 diff --git a/gcc/testsuite/gcc.dg/vect/pr86927.c b/gcc/testsuite/gcc.dg/vect/pr86927.c new file mode 100644 index 00000000000..794092bc4e4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr86927.c @@ -0,0 +1,15 @@ +#include "tree-vect.h" + +int a[28]; +int main() +{ + check_vect (); + a[4] = 1; + int c = 1; + for (int b = 0; b < 8; b++) + if (a[b]) + c = 0; + if (c) + abort(); + return 0; +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index d5e35521cef..124a4be0a67 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5197,6 +5197,9 @@ vect_create_epilog_for_reduction (vec vect_defs, if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) == INTEGER_INDUC_COND_REDUCTION) code = induc_code; + else if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) + == CONST_COND_REDUCTION) + code = STMT_VINFO_VEC_CONST_COND_REDUC_CODE (stmt_info); else code = MAX_EXPR; } -- 2.30.2