diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-08-01 14:40:35 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-08-01 14:40:35 +0000 |
commit | 047fba343dc9fba211a10058bc423c6373cc57f8 (patch) | |
tree | 1c73f7e0d6103bcca887c20c97a53240e62ba7f2 /gcc/tree-vect-patterns.c | |
parent | 094db6beb9cea0aedbde326f271d2b6fab762b1d (diff) | |
download | gcc-047fba343dc9fba211a10058bc423c6373cc57f8.zip gcc-047fba343dc9fba211a10058bc423c6373cc57f8.tar.gz gcc-047fba343dc9fba211a10058bc423c6373cc57f8.tar.bz2 |
Fix over-widening handling of COND_EXPRs (PR 86749)
This PR is a wrong-code bug caused by the over-widening support.
The minimum input precisions for a COND_EXPR are supposed to apply
only to the "then" and "else" values, but here we were applying
them to the operands of a nested COND_EXPR comparison instead.
2018-08-01 Richard Sandiford <richard.sandiford@arm.com>
gcc/
PR tree-optimization/86749
* tree-vect-patterns.c (vect_determine_min_output_precision_1):
If the lhs is used in a COND_EXPR, check that it is being used
as the "then" or "else" value.
gcc/testsuite/
PR tree-optimization/86749
* gcc.dg/vect/pr86749.c: New test.
From-SVN: r263213
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index eb0e296..d41c61a 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -4399,6 +4399,14 @@ vect_determine_min_output_precision_1 (stmt_vec_info stmt_info, tree lhs) stmt_vec_info use_stmt_info = vinfo->lookup_stmt (use_stmt); if (!use_stmt_info || !use_stmt_info->min_input_precision) return false; + /* The input precision recorded for COND_EXPRs applies only to the + "then" and "else" values. */ + gassign *assign = dyn_cast <gassign *> (stmt_info->stmt); + if (assign + && gimple_assign_rhs_code (assign) == COND_EXPR + && use->use != gimple_assign_rhs2_ptr (assign) + && use->use != gimple_assign_rhs3_ptr (assign)) + return false; precision = MAX (precision, use_stmt_info->min_input_precision); } |