diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-03 09:58:47 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-03 09:58:47 +0000 |
commit | 3239dde94019f11e6c1a8c6ae2b3f7d944689148 (patch) | |
tree | b00ef9e296556f69df3860647357ec75f32198ae /gcc/tree-vect-patterns.c | |
parent | 30f502eddecac8ecfbec4b86f3a80f1859076b6d (diff) | |
download | gcc-3239dde94019f11e6c1a8c6ae2b3f7d944689148.zip gcc-3239dde94019f11e6c1a8c6ae2b3f7d944689148.tar.gz gcc-3239dde94019f11e6c1a8c6ae2b3f7d944689148.tar.bz2 |
Avoid matching the same pattern statement twice
r262275 allowed pattern matching on pattern statements. Testing for
SVE on more benchmarks showed a case where this interacted badly
with 14/n.
The new over-widening detection could narrow a COND_EXPR A to another
COND_EXPR B, which mixed_size_cond could then match. This was working
as expected. However, we left B (now dead) in the pattern definition
sequence with a non-null PATTERN_DEF_SEQ. mask_conversion also
matched B, and unlike most recognisers, didn't clear PATTERN_DEF_SEQ
before adding statements to it. This meant that the statements
created by mixed_size_cond appeared in two supposedy separate
sequences, causing much confusion.
This patch removes pattern statements that are replaced by further
pattern statements. As a belt-and-braces fix, it also nullifies
PATTERN_DEF_SEQ on failure, in the same way Richard B. did recently
for RELATED_STMT.
I have patches to clean up the PATTERN_DEF_SEQ handling, but they
only apply after the complete PR85694 sequence, whereas this needs
to go in before 14/n.
2018-07-03 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-patterns.c (vect_mark_pattern_stmts): Remove pattern
statements that have been replaced by further pattern statements.
(vect_pattern_recog_1): Clear STMT_VINFO_PATTERN_DEF_SEQ on failure.
gcc/testsuite/
* gcc.dg/vect/vect-mixed-size-cond-1.c: New test.
From-SVN: r262332
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index 56cfbc6..4ffec66 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -4295,6 +4295,9 @@ vect_mark_pattern_stmts (gimple *orig_stmt, gimple *pattern_stmt, gimple_stmt_iterator gsi = gsi_for_stmt (orig_stmt, orig_def_seq); gsi_insert_seq_before_without_update (&gsi, def_seq, GSI_SAME_STMT); gsi_insert_before_without_update (&gsi, pattern_stmt, GSI_SAME_STMT); + + /* Remove the pattern statement that this new pattern replaces. */ + gsi_remove (&gsi, false); } else vect_set_pattern_stmt (pattern_stmt, orig_stmt_info, pattern_vectype); @@ -4358,6 +4361,8 @@ vect_pattern_recog_1 (vect_recog_func *recog_func, if (!is_pattern_stmt_p (stmt_info)) STMT_VINFO_RELATED_STMT (stmt_info) = NULL; } + /* Clear any half-formed pattern definition sequence. */ + STMT_VINFO_PATTERN_DEF_SEQ (stmt_info) = NULL; return; } |