Message ID | 20101115201646.GD29412@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
On Mon, Nov 15, 2010 at 9:16 PM, Jakub Jelinek <jakub@redhat.com> wrote: > Hi! > > When stmt1 is a byte store instead of memcpy, ptr1 can be > something that is not is_gimple_val. Fixed thusly, bootstrapped/regtested > on x86_64-linux and i686-linux. Ok for trunk? > > Alternatively the conditional could be left out, as force_gimple_operand_gsi > will do nothing if it is is_gimple_val already (but will call is_gimple_val > twice and a couple of other checks). Ok. Thanks, Richard. > 2010-11-15 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/46461 > * tree-ssa-forwprop.c (simplify_builtin_call): Ensure ptr1 is > a gimple val. > > * gcc.c-torture/compile/pr46461.c: New test. > > --- gcc/tree-ssa-forwprop.c.jj 2010-11-09 13:58:30.000000000 +0100 > +++ gcc/tree-ssa-forwprop.c 2010-11-15 11:11:52.000000000 +0100 > @@ -1594,6 +1594,9 @@ simplify_builtin_call (gimple_stmt_itera > memcpy call. */ > gimple_stmt_iterator gsi = gsi_for_stmt (stmt1); > > + if (!is_gimple_val (ptr1)) > + ptr1 = force_gimple_operand_gsi (gsi_p, ptr1, true, NULL_TREE, > + true, GSI_SAME_STMT); > gimple_call_set_fndecl (stmt2, built_in_decls [BUILT_IN_MEMCPY]); > gimple_call_set_arg (stmt2, 0, ptr1); > gimple_call_set_arg (stmt2, 1, new_str_cst); > --- gcc/testsuite/gcc.c-torture/compile/pr46461.c.jj 2010-11-15 11:13:31.000000000 +0100 > +++ gcc/testsuite/gcc.c-torture/compile/pr46461.c 2010-11-15 11:13:15.000000000 +0100 > @@ -0,0 +1,8 @@ > +/* PR tree-optimization/46461 */ > + > +void > +foo (char *c) > +{ > + c[7] = 0xff; > + __builtin_memset (c + 8, 0xff, 8); > +} > > Jakub >
On 11/15/10 13:16, Jakub Jelinek wrote: > Hi! > > When stmt1 is a byte store instead of memcpy, ptr1 can be > something that is not is_gimple_val. Fixed thusly, bootstrapped/regtested > on x86_64-linux and i686-linux. Ok for trunk? > > Alternatively the conditional could be left out, as force_gimple_operand_gsi > will do nothing if it is is_gimple_val already (but will call is_gimple_val > twice and a couple of other checks). > > 2010-11-15 Jakub Jelinek<jakub@redhat.com> > > PR tree-optimization/46461 > * tree-ssa-forwprop.c (simplify_builtin_call): Ensure ptr1 is > a gimple val. > > * gcc.c-torture/compile/pr46461.c: New test. OK. jeff
--- gcc/tree-ssa-forwprop.c.jj 2010-11-09 13:58:30.000000000 +0100 +++ gcc/tree-ssa-forwprop.c 2010-11-15 11:11:52.000000000 +0100 @@ -1594,6 +1594,9 @@ simplify_builtin_call (gimple_stmt_itera memcpy call. */ gimple_stmt_iterator gsi = gsi_for_stmt (stmt1); + if (!is_gimple_val (ptr1)) + ptr1 = force_gimple_operand_gsi (gsi_p, ptr1, true, NULL_TREE, + true, GSI_SAME_STMT); gimple_call_set_fndecl (stmt2, built_in_decls [BUILT_IN_MEMCPY]); gimple_call_set_arg (stmt2, 0, ptr1); gimple_call_set_arg (stmt2, 1, new_str_cst); --- gcc/testsuite/gcc.c-torture/compile/pr46461.c.jj 2010-11-15 11:13:31.000000000 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr46461.c 2010-11-15 11:13:15.000000000 +0100 @@ -0,0 +1,8 @@ +/* PR tree-optimization/46461 */ + +void +foo (char *c) +{ + c[7] = 0xff; + __builtin_memset (c + 8, 0xff, 8); +}