[PATCH]: PR 30590 invalid optimization by tree-nrv

Seongbae Park seongbae.park@gmail.com
Thu Mar 15 23:40:00 GMT 2007


On 3/13/07, Diego Novillo <dnovillo@redhat.com> wrote:
> Seongbae Park wrote on 03/14/07 00:05:
>
> >         PR tree-optimization/30590
> >
> >         * tree-nrv.c (tree_nrv): Check for the partial update of the
> > return value.
>
> OK everywhere.

Attached is the backport of the patch to 4.2 and 4.1.
I needed to make the obvious changes.
4.2 change is already bootstrapped and regtested on i686.
4.1 test is in progress.

This probably qualifies as obvious but just in case
I'm sending this out before committing,
as there is changes in the patch.
-- 
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"
-------------- next part --------------
Index: gcc/tree-nrv.c
===================================================================
--- gcc/tree-nrv.c	(revision 122924)
+++ gcc/tree-nrv.c	(working copy)
@@ -163,6 +163,14 @@ tree_nrv (void)
 						     result_type))
 		return 0;
 	    }
+	  else if (TREE_CODE (stmt) == MODIFY_EXPR)
+	    {
+	      tree addr = get_base_address (TREE_OPERAND (stmt, 0));
+	       /* If there's any MODIFY of component of RESULT, 
+		  then bail out.  */
+	      if (addr && addr == result)
+		return 0;
+	    }
 	}
     }
 


More information about the Gcc-patches mailing list