Message ID | 20111124150804.GI27242@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
Hi, On Thu, 24 Nov 2011, Jakub Jelinek wrote: > When stmt is mem = {v} {CLOBBER};, then lhs is neither > SSA_NAME, but it doesn't satisfy gimple_assign_copy_p either. > With this patch it will set the new_tree also to the clobber, > making it clear that the next iteration uses unitialized variable. Hmm. My guts don't like clobbers on the RHS of normal ssa operations. Usually our uninitialized values are the default defs of SSA names that aren't PARM_DECLs. I don't like having two ways of expressing uninitializedness. As the default defs are already automatically handled by all our ssa infrastructure (including warning and propagation machinery) I think it would be best to generate such one instead of a clobber for the RHS. Ciao, Michael.
On Thu, Nov 24, 2011 at 5:28 PM, Michael Matz <matz@suse.de> wrote: > Hi, > > On Thu, 24 Nov 2011, Jakub Jelinek wrote: > >> When stmt is mem = {v} {CLOBBER};, then lhs is neither >> SSA_NAME, but it doesn't satisfy gimple_assign_copy_p either. >> With this patch it will set the new_tree also to the clobber, >> making it clear that the next iteration uses unitialized variable. > > Hmm. My guts don't like clobbers on the RHS of normal ssa operations. > Usually our uninitialized values are the default defs of SSA names that > aren't PARM_DECLs. I don't like having two ways of expressing > uninitializedness. > > As the default defs are already automatically handled by all our ssa > infrastructure (including warning and propagation machinery) I think it > would be best to generate such one instead of a clobber for the RHS. I think the patch is ok. Does the CLOBBER get re-placed anywhere? Richard. > > Ciao, > Michael.
--- gcc/tree-predcom.c.jj 2011-09-26 14:07:06.000000000 +0200 +++ gcc/tree-predcom.c 2011-11-24 09:17:46.872962765 +0100 @@ -1306,8 +1306,10 @@ replace_ref_with (gimple stmt, tree new_ val = gimple_assign_lhs (stmt); if (TREE_CODE (val) != SSA_NAME) { - gcc_assert (gimple_assign_copy_p (stmt)); val = gimple_assign_rhs1 (stmt); + gcc_assert (gimple_assign_single_p (stmt) + && (gimple_assign_copy_p (stmt) + || TREE_CLOBBER_P (val))); } } else --- gcc/testsuite/gcc.c-torture/compile/pr51246.c.jj 2011-11-24 09:15:10.322906812 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr51246.c 2011-11-24 09:14:52.000000000 +0100 @@ -0,0 +1,14 @@ +/* PR tree-optimization/51246 */ + +int a, *b; + +void +test (void) +{ + while (1) + { + int c; + a = c; + b = &c; + } +}