From 714fc568abfd02d7dc28607ff60301902f830917 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 8 Nov 2019 09:30:52 +0000 Subject: [PATCH] re PR tree-optimization/92324 (ICE in expand_direct_optab_fn, at internal-fn.c:2890) 2019-11-08 Richard Biener PR tree-optimization/92324 * tree-vect-loop.c (vect_create_epilog_for_reduction): Use STMT_VINFO_REDUC_VECTYPE for all computations, inserting sign-conversions as necessary. (vectorizable_reduction): Reject conversions in the chain that are not sign-conversions, base analysis on a non-converting stmt and its operation sign. Set STMT_VINFO_REDUC_VECTYPE. * tree-vect-stmts.c (vect_stmt_relevant_p): Don't dump anything for debug stmts. * tree-vectorizer.h (_stmt_vec_info::reduc_vectype): New. (STMT_VINFO_REDUC_VECTYPE): Likewise. * gcc.dg/vect/pr92205.c: XFAIL. * gcc.dg/vect/pr92324-1.c: New testcase. * gcc.dg/vect/pr92324-2.c: Likewise. From-SVN: r277958 --- gcc/testsuite/gcc.dg/vect/pr92324-1.c | 14 ++++++++++++++ gcc/testsuite/gcc.dg/vect/pr92324-2.c | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/pr92324-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/pr92324-2.c diff --git a/gcc/testsuite/gcc.dg/vect/pr92324-1.c b/gcc/testsuite/gcc.dg/vect/pr92324-1.c new file mode 100644 index 00000000000..e37fa781dd2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr92324-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +unsigned a, b; +int c, d; +unsigned e(int f) { + if (a > f) + return a; + return f; +} +void g() { + for (; c; c++) + d = e(d); + b = d; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr92324-2.c b/gcc/testsuite/gcc.dg/vect/pr92324-2.c new file mode 100644 index 00000000000..c7805fc62de --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr92324-2.c @@ -0,0 +1,21 @@ +#include "tree-vect.h" + +unsigned b[1024]; + +int __attribute__((noipa)) +foo (int n) +{ + int res = 0; + for (int i = 0; i < n; ++i) + res = res > b[i] ? res : b[i]; + return res; +} + +int main () +{ + check_vect (); + b[15] = (unsigned)__INT_MAX__ + 1; + if (foo (16) != -__INT_MAX__ - 1) + __builtin_abort (); + return 0; +} -- 2.30.2