mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/72866 (Compile time hog w/ -O3 (-Ofast))
PR tree-optimization/72866 * tree-vect-patterns.c (search_type_for_mask): Turn into a small wrapper, move all code to ... (search_type_for_mask_1): ... this new function. Add caching and adjust recursive calls. * gcc.dg/vect/pr72866.c: New test. From-SVN: r239856
This commit is contained in:
parent
3754bbfc36
commit
5116b156b7
|
|
@ -1,5 +1,11 @@
|
||||||
2016-08-30 Jakub Jelinek <jakub@redhat.com>
|
2016-08-30 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/72866
|
||||||
|
* tree-vect-patterns.c (search_type_for_mask): Turn into
|
||||||
|
a small wrapper, move all code to ...
|
||||||
|
(search_type_for_mask_1): ... this new function. Add caching
|
||||||
|
and adjust recursive calls.
|
||||||
|
|
||||||
PR debug/77363
|
PR debug/77363
|
||||||
* dwarf2out.c (modified_type_die): Use lookup_type_die (type)
|
* dwarf2out.c (modified_type_die): Use lookup_type_die (type)
|
||||||
instead of lookup_type_die (type_main_variant (type)) even for array
|
instead of lookup_type_die (type_main_variant (type)) even for array
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
2016-08-30 Jakub Jelinek <jakub@redhat.com>
|
2016-08-30 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
|
PR tree-optimization/72866
|
||||||
|
* gcc.dg/vect/pr72866.c: New test.
|
||||||
|
|
||||||
PR debug/77363
|
PR debug/77363
|
||||||
* g++.dg/debug/dwarf2/pr77363.C: New test.
|
* g++.dg/debug/dwarf2/pr77363.C: New test.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* PR tree-optimization/72866 */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
unsigned int dl;
|
||||||
|
int rx, lb;
|
||||||
|
|
||||||
|
void
|
||||||
|
fo (int jv, int be)
|
||||||
|
{
|
||||||
|
const unsigned int xw = 16;
|
||||||
|
unsigned int ya, wo;
|
||||||
|
|
||||||
|
for (ya = 0; ya < 2; ++ya)
|
||||||
|
for (wo = 0; wo < xw; ++wo)
|
||||||
|
{
|
||||||
|
dl += (jv ? be : rx);
|
||||||
|
rx += ((lb == 0) + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3459,13 +3459,11 @@ adjust_bool_stmts (hash_set <gimple *> &bool_stmt_set,
|
||||||
return gimple_assign_lhs (pattern_stmt);
|
return gimple_assign_lhs (pattern_stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the proper type for converting bool VAR into
|
/* Helper for search_type_for_mask. */
|
||||||
an integer value or NULL_TREE if no such type exists.
|
|
||||||
The type is chosen so that converted value has the
|
|
||||||
same number of elements as VAR's vector type. */
|
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
search_type_for_mask (tree var, vec_info *vinfo)
|
search_type_for_mask_1 (tree var, vec_info *vinfo,
|
||||||
|
hash_map<gimple *, tree> &cache)
|
||||||
{
|
{
|
||||||
gimple *def_stmt;
|
gimple *def_stmt;
|
||||||
enum vect_def_type dt;
|
enum vect_def_type dt;
|
||||||
|
|
@ -3490,6 +3488,10 @@ search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
if (!is_gimple_assign (def_stmt))
|
if (!is_gimple_assign (def_stmt))
|
||||||
return NULL_TREE;
|
return NULL_TREE;
|
||||||
|
|
||||||
|
tree *c = cache.get (def_stmt);
|
||||||
|
if (c)
|
||||||
|
return *c;
|
||||||
|
|
||||||
rhs_code = gimple_assign_rhs_code (def_stmt);
|
rhs_code = gimple_assign_rhs_code (def_stmt);
|
||||||
rhs1 = gimple_assign_rhs1 (def_stmt);
|
rhs1 = gimple_assign_rhs1 (def_stmt);
|
||||||
|
|
||||||
|
|
@ -3498,14 +3500,15 @@ search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
case SSA_NAME:
|
case SSA_NAME:
|
||||||
case BIT_NOT_EXPR:
|
case BIT_NOT_EXPR:
|
||||||
CASE_CONVERT:
|
CASE_CONVERT:
|
||||||
res = search_type_for_mask (rhs1, vinfo);
|
res = search_type_for_mask_1 (rhs1, vinfo, cache);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BIT_AND_EXPR:
|
case BIT_AND_EXPR:
|
||||||
case BIT_IOR_EXPR:
|
case BIT_IOR_EXPR:
|
||||||
case BIT_XOR_EXPR:
|
case BIT_XOR_EXPR:
|
||||||
res = search_type_for_mask (rhs1, vinfo);
|
res = search_type_for_mask_1 (rhs1, vinfo, cache);
|
||||||
res2 = search_type_for_mask (gimple_assign_rhs2 (def_stmt), vinfo);
|
res2 = search_type_for_mask_1 (gimple_assign_rhs2 (def_stmt), vinfo,
|
||||||
|
cache);
|
||||||
if (!res || (res2 && TYPE_PRECISION (res) > TYPE_PRECISION (res2)))
|
if (!res || (res2 && TYPE_PRECISION (res) > TYPE_PRECISION (res2)))
|
||||||
res = res2;
|
res = res2;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3517,8 +3520,9 @@ search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
|
|
||||||
if (TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE)
|
if (TREE_CODE (TREE_TYPE (rhs1)) == BOOLEAN_TYPE)
|
||||||
{
|
{
|
||||||
res = search_type_for_mask (rhs1, vinfo);
|
res = search_type_for_mask_1 (rhs1, vinfo, cache);
|
||||||
res2 = search_type_for_mask (gimple_assign_rhs2 (def_stmt), vinfo);
|
res2 = search_type_for_mask_1 (gimple_assign_rhs2 (def_stmt),
|
||||||
|
vinfo, cache);
|
||||||
if (!res || (res2 && TYPE_PRECISION (res) > TYPE_PRECISION (res2)))
|
if (!res || (res2 && TYPE_PRECISION (res) > TYPE_PRECISION (res2)))
|
||||||
res = res2;
|
res = res2;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3526,12 +3530,18 @@ search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
|
|
||||||
comp_vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
|
comp_vectype = get_vectype_for_scalar_type (TREE_TYPE (rhs1));
|
||||||
if (comp_vectype == NULL_TREE)
|
if (comp_vectype == NULL_TREE)
|
||||||
return NULL_TREE;
|
{
|
||||||
|
res = NULL_TREE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
mask_type = get_mask_type_for_scalar_type (TREE_TYPE (rhs1));
|
mask_type = get_mask_type_for_scalar_type (TREE_TYPE (rhs1));
|
||||||
if (!mask_type
|
if (!mask_type
|
||||||
|| !expand_vec_cmp_expr_p (comp_vectype, mask_type))
|
|| !expand_vec_cmp_expr_p (comp_vectype, mask_type))
|
||||||
return NULL_TREE;
|
{
|
||||||
|
res = NULL_TREE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (TREE_CODE (TREE_TYPE (rhs1)) != INTEGER_TYPE
|
if (TREE_CODE (TREE_TYPE (rhs1)) != INTEGER_TYPE
|
||||||
|| !TYPE_UNSIGNED (TREE_TYPE (rhs1)))
|
|| !TYPE_UNSIGNED (TREE_TYPE (rhs1)))
|
||||||
|
|
@ -3544,9 +3554,21 @@ search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cache.put (def_stmt, res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the proper type for converting bool VAR into
|
||||||
|
an integer value or NULL_TREE if no such type exists.
|
||||||
|
The type is chosen so that converted value has the
|
||||||
|
same number of elements as VAR's vector type. */
|
||||||
|
|
||||||
|
static tree
|
||||||
|
search_type_for_mask (tree var, vec_info *vinfo)
|
||||||
|
{
|
||||||
|
hash_map<gimple *, tree> cache;
|
||||||
|
return search_type_for_mask_1 (var, vinfo, cache);
|
||||||
|
}
|
||||||
|
|
||||||
/* Function vect_recog_bool_pattern
|
/* Function vect_recog_bool_pattern
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue