aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-forwprop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-02-04 10:03:03 +0100
committerRichard Biener <rguenther@suse.de>2020-02-04 10:07:47 +0100
commitfc98d038618b792c413212759057b2125507d3ef (patch)
tree5a058136f04c3653b1fa670f6650cd815995aa8d /gcc/tree-ssa-forwprop.c
parent9a4d502421c7469369d863226f03d197bfa2cb13 (diff)
downloadgcc-fc98d038618b792c413212759057b2125507d3ef.zip
gcc-fc98d038618b792c413212759057b2125507d3ef.tar.gz
gcc-fc98d038618b792c413212759057b2125507d3ef.tar.bz2
tree-optimization/92819 restrict new vector CTOR canonicalization
The PR shows that code generation ends up pessimized by the new canonicalization rules that end up nailing do-not-care elements to specific values making it hard to generate good code later. The temporary solution is to avoid this for the cases we also obviously know the canonicalization will create more GIMPLE stmts than before. 2020-02-04 Richard Biener <rguenther@suse.de> PR tree-optimization/92819 * tree-ssa-forwprop.c (simplify_vector_constructor): Avoid generating more stmts than before. * gcc.target/i386/pr92819.c: New testcase. * gcc.target/i386/pr92803.c: Adjust.
Diffstat (limited to 'gcc/tree-ssa-forwprop.c')
-rw-r--r--gcc/tree-ssa-forwprop.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 5203891..f65216d 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -2230,7 +2230,6 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
unsigned HOST_WIDE_INT refnelts;
enum tree_code conv_code;
constructor_elt *elt;
- bool maybe_ident;
op = gimple_assign_rhs1 (stmt);
type = TREE_TYPE (op);
@@ -2245,7 +2244,8 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
orig[0] = NULL;
orig[1] = NULL;
conv_code = ERROR_MARK;
- maybe_ident = true;
+ bool maybe_ident = true;
+ bool maybe_blend[2] = { true, true };
tree one_constant = NULL_TREE;
tree one_nonconstant = NULL_TREE;
auto_vec<tree> constants;
@@ -2290,6 +2290,8 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
orig[j] = ref;
if (elem != i || j != 0)
maybe_ident = false;
+ if (elem != i)
+ maybe_blend[j] = false;
elts.safe_push (std::make_pair (j, elem));
continue;
}
@@ -2439,6 +2441,15 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi)
}
else
{
+ /* If we combine a vector with a non-vector avoid cases where
+ we'll obviously end up with more GIMPLE stmts which is when
+ we'll later not fold this to a single insert into the vector
+ and we had a single extract originally. See PR92819. */
+ if (nelts == 2
+ && refnelts > 2
+ && orig[1] == error_mark_node
+ && !maybe_blend[0])
+ return false;
tree mask_type, perm_type, conv_src_type;
perm_type = TREE_TYPE (orig[0]);
conv_src_type = (nelts == refnelts