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]

[tree-ssa] More "const" call elimination infrastructure



Whee.  I just love it when important code gets removed (or never emitted
to begin with).

When inlining a gimplified function TREE_SIDE_EFFECTS needs to be recomputed,
not simply copied from the CALL_EXPR since TREE_SIDE_EFFECTS may be cleared
by the gimplifier for CALL_EXPRs associated with "const" calls.


	* tree-inline.c (expand_call_inline): Recalculate TREE_SIDE_EFFECTS
	properly when inlining gimplified functions.

Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.31
diff -c -3 -p -r1.26.2.31 tree-inline.c
*** tree-inline.c	7 Jun 2003 15:18:36 -0000	1.26.2.31
--- tree-inline.c	12 Jun 2003 04:53:58 -0000
*************** expand_call_inline (tp, walk_subtrees, d
*** 1177,1182 ****
--- 1177,1196 ----
  	}
        else
  	*tp = expr;
+ 
+       /* When we gimplify a function call, we may clear TREE_SIDE_EFFECTS
+ 	 on the call if it is to a "const" function.  Thus the copy of
+ 	 TREE_SIDE_EFFECTS from the CALL_EXPR to the BIND_EXPR above
+ 	 with result in TREE_SIDE_EFFECTS not being set for the inlined
+ 	 copy of a "const" function.
+ 
+ 	 Unfortunately, that is wrong as inlining the function
+ 	 can create/expose interesting side effects (such as setting
+ 	 of a return value).
+ 
+ 	 The easiest solution is to simply recalculate TREE_SIDE_EFFECTS
+ 	 for the toplevel expression.  */
+       recalculate_side_effects (expr);
      }
    else
      *tp = expr;



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