This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix up gimplify_and_update_call_from_tree (PR tree-optimization/52318)


On Tue, 21 Feb 2012, Jakub Jelinek wrote:

> Hi!
> 
> This function spends significant amount of code to update the virtual
> uses/defs in the new sequence, but only handles that way stores, not
> non-pure/const calls, so we ICE during tree DSE on this testcase, because
> vop has been marked for renaming.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
> for trunk?

Ok.

Thanks,
Richard.

> 2012-02-20  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR tree-optimization/52318
> 	* gimple-fold.c (gimplify_and_update_call_from_tree): Add
> 	vdef also to non-pure/const call stmts in the sequence.
> 
> 	* gcc.dg/pr52318.c: New test.
> 
> --- gcc/gimple-fold.c.jj	2011-12-16 08:37:45.000000000 +0100
> +++ gcc/gimple-fold.c	2012-02-20 21:51:20.853133362 +0100
> @@ -591,8 +591,11 @@ gimplify_and_update_call_from_tree (gimp
>    for (i = gsi_last (stmts); !gsi_end_p (i); gsi_prev (&i))
>      {
>        new_stmt = gsi_stmt (i);
> -      if (gimple_assign_single_p (new_stmt)
> -	  && !is_gimple_reg (gimple_assign_lhs (new_stmt)))
> +      if ((gimple_assign_single_p (new_stmt)
> +	   && !is_gimple_reg (gimple_assign_lhs (new_stmt)))
> +	  || (is_gimple_call (new_stmt)
> +	      && (gimple_call_flags (new_stmt)
> +		  & (ECF_NOVOPS | ECF_PURE | ECF_CONST | ECF_NORETURN)) == 0))
>  	{
>  	  tree vdef;
>  	  if (!laststore)
> --- gcc/testsuite/gcc.dg/pr52318.c.jj	2012-02-20 22:10:09.211778710 +0100
> +++ gcc/testsuite/gcc.dg/pr52318.c	2012-02-20 22:09:10.000000000 +0100
> @@ -0,0 +1,17 @@
> +/* PR tree-optimization/52318 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -ftracer -fno-tree-ccp -fno-tree-copy-prop -fno-tree-dce" } */
> +
> +int c;
> +char *p;
> +
> +void
> +foo (int i)
> +{
> +  char a[2];
> +  char b[20];
> +  p = __builtin___stpcpy_chk (a, "", 2);
> +  p = __builtin___stpcpy_chk (&b[16], i ? "e" : "jkl", 4);
> +  if (c)
> +    foo (i);
> +}
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]