Commit 5feb49f0 by Martin Jambor Committed by Martin Jambor

re PR middle-end/44133 (Uninit warning regression with new SRA)

2010-05-17  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/44133
	* tree-sra.c (create_access_replacement): New parameter rename, mark
	the replaement for renaming only when it is true.
	(get_access_replacement): Pass true in the rename parameter of
	create_access_replacement.
	(get_unrenamed_access_replacement): New function.
	(replace_uses_with_default_def_ssa_name): New parameter racc, get the
	replacement declaration from it.

	* testsuite/gcc.dg/tree-ssa/pr44133.c: New test.
	* testsuite/gcc.dg/tree-ssa/sra-9.c: Make the scan regular
	expression more precise.

From-SVN: r159482
parent 56731d64
2010-05-17 Martin Jambor <mjambor@suse.cz>
PR middle-end/44133
* tree-sra.c (create_access_replacement): New parameter rename, mark
the replaement for renaming only when it is true.
(get_access_replacement): Pass true in the rename parameter of
create_access_replacement.
(get_unrenamed_access_replacement): New function.
(replace_uses_with_default_def_ssa_name): New parameter racc, get the
replacement declaration from it.
2010-05-17 Bernd Schmidt <bernds@codesourcery.com>
* function.c (try_fit_stack_local, add_frame_space): New static
......
2010-05-17 Martin Jambor <mjambor@suse.cz>
PR middle-end/44133
* gcc.dg/tree-ssa/pr44133.c: New test.
* gcc.dg/tree-ssa/sra-9.c: Make the scan regular expression more
precise.
2010-05-17 Janus Weil <janus@gcc.gnu.org>
PR fortran/44044
......
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */
struct S { int i, j; };
int foo (int l)
{
struct S s;
s.j = l - 22; /* { dg-warning ".s\.i. is used uninitialized" } */
return s.i + s.j;
}
......@@ -16,5 +16,5 @@ int foo (int d)
}
/* There should be no reference to s.b. */
/* { dg-final { scan-tree-dump-times "s\.b" 0 "optimized"} } */
/* { dg-final { scan-tree-dump-times "= s\.b" 0 "optimized"} } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
......@@ -1586,14 +1586,15 @@ sort_and_splice_var_accesses (tree var)
ACCESS->replacement. */
static tree
create_access_replacement (struct access *access)
create_access_replacement (struct access *access, bool rename)
{
tree repl;
repl = create_tmp_var (access->type, "SR");
get_var_ann (repl);
add_referenced_var (repl);
mark_sym_for_renaming (repl);
if (rename)
mark_sym_for_renaming (repl);
if (!access->grp_partial_lhs
&& (TREE_CODE (access->type) == COMPLEX_TYPE
......@@ -1669,10 +1670,24 @@ get_access_replacement (struct access *access)
gcc_assert (access->grp_to_be_replaced);
if (!access->replacement_decl)
access->replacement_decl = create_access_replacement (access);
access->replacement_decl = create_access_replacement (access, true);
return access->replacement_decl;
}
/* Return ACCESS scalar replacement, create it if it does not exist yet but do
not mark it for renaming. */
static inline tree
get_unrenamed_access_replacement (struct access *access)
{
gcc_assert (!access->grp_to_be_replaced);
if (!access->replacement_decl)
access->replacement_decl = create_access_replacement (access, false);
return access->replacement_decl;
}
/* Build a subtree of accesses rooted in *ACCESS, and move the pointer in the
linked list along the way. Stop when *ACCESS is NULL or the access pointed
to it is not "within" the root. */
......@@ -2507,29 +2522,21 @@ sra_modify_constructor_assign (gimple *stmt, gimple_stmt_iterator *gsi)
}
/* Create a new suitable default definition SSA_NAME and replace all uses of
SSA with it. */
SSA with it, RACC is access describing the uninitialized part of an
aggregate that is being loaded. */
static void
replace_uses_with_default_def_ssa_name (tree ssa)
replace_uses_with_default_def_ssa_name (tree ssa, struct access *racc)
{
tree repl, decl = SSA_NAME_VAR (ssa);
if (TREE_CODE (decl) == PARM_DECL)
{
tree tmp = create_tmp_reg (TREE_TYPE (decl), "SR");
tree repl, decl;
get_var_ann (tmp);
add_referenced_var (tmp);
repl = make_ssa_name (tmp, gimple_build_nop ());
set_default_def (tmp, repl);
}
else
decl = get_unrenamed_access_replacement (racc);
repl = gimple_default_def (cfun, decl);
if (!repl)
{
repl = gimple_default_def (cfun, decl);
if (!repl)
{
repl = make_ssa_name (decl, gimple_build_nop ());
set_default_def (decl, repl);
}
repl = make_ssa_name (decl, gimple_build_nop ());
set_default_def (decl, repl);
}
replace_uses_by (ssa, repl);
......@@ -2717,7 +2724,7 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi)
false, false);
gcc_assert (*stmt == gsi_stmt (*gsi));
if (TREE_CODE (lhs) == SSA_NAME)
replace_uses_with_default_def_ssa_name (lhs);
replace_uses_with_default_def_ssa_name (lhs, racc);
unlink_stmt_vdef (*stmt);
gsi_remove (gsi, true);
......
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