Fix EXTRACT_LAST_REDUCTION segfault
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 31 Dec 2019 15:32:06 +0000 (15:32 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 31 Dec 2019 15:32:06 +0000 (15:32 +0000)
commitdc176c3ccd6a8cd3f809f3c1549ad00674061eb5
treee3031a3fa6224b66dbc492230ee7996572dd0cbc
parent2c8297996a7ab3496c5d2f798cdbe4cab749468e
Fix EXTRACT_LAST_REDUCTION segfault

This code:

      /* Make sure we don't accidentally use the old condition.  */
      cond_expr = NULL_TREE;

was misplaced, since it triggered even when we needed to force the
original unmodified cond_expr into a mask temporary and then invert it.

2019-12-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
* tree-vect-stmts.c (vectorizable_condition): Only nullify cond_expr
if we've created a new condition.  Don't nullify it if we've decided
to keep it and then invert the result.

gcc/testsuite/
* gcc.dg/vect/vect-cond-reduc-6.c: New test.

From-SVN: r279804
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-cond-reduc-6.c [new file with mode: 0644]
gcc/tree-vect-stmts.c