------- Comment #3 from jamborm at gcc dot gnu dot org 2009-10-05 13:22 ------- On IRC, Jakub told me to remove the value_expr flag after gimplification and to introduce a new dummy var decl with the flag set for the purpose of debugging. My first attempt is the following patch. It did bootstrap on the hppa we have on the compile farm (over the weekend :-) and the testsuite seem to have only one new regression (g++.dg/inherit/thunk6.C). I am about to do a non-bootstrap build to examine that as well as the debug info performance now.
Nevertheless, I'll be grateful for any comments even at this stage, expecially regarding attributes that need to be (or should not be) copied to the new dummy declaration. Those dealt with in the patch are from copy_var_decl() in omp-low.c (which I did not call directly because it sets DECL_SEEN_IN_BIND_EXPR_P). 2009-10-05 Martin Jambor <mjam...@suse.cz> PR middle-end/41250 * function.c (fixup_value_expr_parm_decls): New function. * tree.h (fixup_value_expr_parm_decls): Declare. * gimplify.c (gimplify_body): Call fixup_value_expr_parm_decls. Index: small/gcc/function.c =================================================================== --- small.orig/gcc/function.c +++ small/gcc/function.c @@ -3438,6 +3438,31 @@ gimplify_parameters (void) return stmts; } + +/* Remove DECL_HAS_VALUE_EXPR_P flag from parameters so that that such + declarations do not occur in the IL. */ + +void +fixup_value_expr_parm_decls (void) +{ + tree parm, fnargs = DECL_ARGUMENTS (current_function_decl); + + for (parm = fnargs; parm; parm = TREE_CHAIN (parm)) + if (DECL_HAS_VALUE_EXPR_P (parm)) + { + tree copy = build_decl (DECL_SOURCE_LOCATION (parm), VAR_DECL, + DECL_NAME (parm), TREE_TYPE (parm)); + DECL_ARTIFICIAL (copy) = DECL_ARTIFICIAL (parm); + DECL_IGNORED_P (copy) = DECL_IGNORED_P (parm); + DECL_CONTEXT (copy) = DECL_CONTEXT (parm); + TREE_USED (copy) = 1; + SET_DECL_VALUE_EXPR (copy, DECL_VALUE_EXPR (parm)); + DECL_HAS_VALUE_EXPR_P (copy) = 1; + + DECL_HAS_VALUE_EXPR_P (parm) = 0; + DECL_IGNORED_P (parm) = 1; + } +} /* Compute the size and offset from the start of the stacked arguments for a parm passed in mode PASSED_MODE and with type TYPE. Index: small/gcc/gimplify.c =================================================================== --- small.orig/gcc/gimplify.c +++ small/gcc/gimplify.c @@ -7482,6 +7482,7 @@ gimplify_body (tree *body_p, tree fndecl { gimplify_seq_add_seq (&parm_stmts, gimple_bind_body (outer_bind)); gimple_bind_set_body (outer_bind, parm_stmts); + fixup_value_expr_parm_decls (); } if (nonlocal_vlas) Index: small/gcc/tree.h =================================================================== --- small.orig/gcc/tree.h +++ small/gcc/tree.h @@ -4994,6 +4994,7 @@ extern int aggregate_value_p (const_tree extern void push_function_context (void); extern void pop_function_context (void); extern gimple_seq gimplify_parameters (void); +extern void fixup_value_expr_parm_decls (void); /* In print-rtl.c */ #ifdef BUFSIZ -- jamborm at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at redhat dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41250