Commit fe8a86e1 by Richard Biener Committed by Richard Biener

re PR middle-end/63155 (memory hog)

2018-10-09  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/63155
	* tree-ssa-structalias.c: Include tree-ssa.h.
	(get_constraint_for_ssa_var): For undefs return nothing_id.
	(find_func_aliases): Cleanup PHI handling.

From-SVN: r264956
parent c885142a
2018-10-09 Richard Biener <rguenther@suse.de> 2018-10-09 Richard Biener <rguenther@suse.de>
PR tree-optimization/63155
* tree-ssa-structalias.c: Include tree-ssa.h.
(get_constraint_for_ssa_var): For undefs return nothing_id.
(find_func_aliases): Cleanup PHI handling.
2018-10-09 Richard Biener <rguenther@suse.de>
* tree-vectorizer.c (dump_stmt_cost): Fix cut&paste missing * tree-vectorizer.c (dump_stmt_cost): Fix cut&paste missing
replacements. replacements.
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "varasm.h" #include "varasm.h"
#include "stringpool.h" #include "stringpool.h"
#include "attribs.h" #include "attribs.h"
#include "tree-ssa.h"
/* The idea behind this analyzer is to generate set constraints from the /* The idea behind this analyzer is to generate set constraints from the
program, then solve the resulting constraints in order to generate the program, then solve the resulting constraints in order to generate the
...@@ -2928,15 +2929,26 @@ get_constraint_for_ssa_var (tree t, vec<ce_s> *results, bool address_p) ...@@ -2928,15 +2929,26 @@ get_constraint_for_ssa_var (tree t, vec<ce_s> *results, bool address_p)
/* We allow FUNCTION_DECLs here even though it doesn't make much sense. */ /* We allow FUNCTION_DECLs here even though it doesn't make much sense. */
gcc_assert (TREE_CODE (t) == SSA_NAME || DECL_P (t)); gcc_assert (TREE_CODE (t) == SSA_NAME || DECL_P (t));
/* For parameters, get at the points-to set for the actual parm
decl. */
if (TREE_CODE (t) == SSA_NAME if (TREE_CODE (t) == SSA_NAME
&& SSA_NAME_IS_DEFAULT_DEF (t) && SSA_NAME_IS_DEFAULT_DEF (t))
&& (TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
|| TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL))
{ {
get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p); /* For parameters, get at the points-to set for the actual parm
return; decl. */
if (TREE_CODE (SSA_NAME_VAR (t)) == PARM_DECL
|| TREE_CODE (SSA_NAME_VAR (t)) == RESULT_DECL)
{
get_constraint_for_ssa_var (SSA_NAME_VAR (t), results, address_p);
return;
}
/* For undefined SSA names return nothing. */
else if (!ssa_defined_default_def_p (t))
{
cexpr.var = nothing_id;
cexpr.type = SCALAR;
cexpr.offset = 0;
results->safe_push (cexpr);
return;
}
} }
/* For global variables resort to the alias target. */ /* For global variables resort to the alias target. */
...@@ -4833,35 +4845,19 @@ find_func_aliases (struct function *fn, gimple *origt) ...@@ -4833,35 +4845,19 @@ find_func_aliases (struct function *fn, gimple *origt)
gimple *t = origt; gimple *t = origt;
auto_vec<ce_s, 16> lhsc; auto_vec<ce_s, 16> lhsc;
auto_vec<ce_s, 16> rhsc; auto_vec<ce_s, 16> rhsc;
struct constraint_expr *c;
varinfo_t fi; varinfo_t fi;
/* Now build constraints expressions. */ /* Now build constraints expressions. */
if (gimple_code (t) == GIMPLE_PHI) if (gimple_code (t) == GIMPLE_PHI)
{ {
size_t i;
unsigned int j;
/* For a phi node, assign all the arguments to /* For a phi node, assign all the arguments to
the result. */ the result. */
get_constraint_for (gimple_phi_result (t), &lhsc); get_constraint_for (gimple_phi_result (t), &lhsc);
for (i = 0; i < gimple_phi_num_args (t); i++) for (unsigned i = 0; i < gimple_phi_num_args (t); i++)
{ {
tree strippedrhs = PHI_ARG_DEF (t, i);
STRIP_NOPS (strippedrhs);
get_constraint_for_rhs (gimple_phi_arg_def (t, i), &rhsc); get_constraint_for_rhs (gimple_phi_arg_def (t, i), &rhsc);
process_all_all_constraints (lhsc, rhsc);
FOR_EACH_VEC_ELT (lhsc, j, c) rhsc.truncate (0);
{
struct constraint_expr *c2;
while (rhsc.length () > 0)
{
c2 = &rhsc.last ();
process_constraint (new_constraint (*c, *c2));
rhsc.pop ();
}
}
} }
} }
/* In IPA mode, we need to generate constraints to pass call /* In IPA mode, we need to generate constraints to pass call
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment