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: [committed][lto merge]: Various minor fixes


On Fri, Apr 17, 2009 at 11:44 PM, Diego Novillo <dnovillo@google.com> wrote:
> This patch contains a bunch of minor obvious fixes that we found
> in the lto branch.
>
> - Fixing DECL_CONTEXT for new generated temporaries ins omp-low.c
> ?and cgraphunit.c
> - Some code factoring used by LTO (find_referenced_vars_in).
> - Change a segmentation fault into an assertion in
> ?create_expression_by_pieces. ?This simplified debugging of an
> ?LTO problem.
> - Dependency fixes for Makefile.in
> - Fix an ODR violation in builtins/strlen-3.c. ?Variable
> ?inside_main was declared with incompatible types in two
> ?different files. ?This only shows up on LTO compiles, of
> ?course.
>
> Bootstrapped and tested on x86_64. ?Applied to mainline.
>
>
> Diego.
>
>
>
> ? ? ? ?* omp-low.c (create_omp_child_function): Set DECL_CONTEXT
> ? ? ? ?for DECL.
> ? ? ? ?* cgraphunit.c (cgraph_build_static_cdtor): Likewise.
> ? ? ? ?* tree-dfa.c (find_referenced_vars_in): Factor out of ...
> ? ? ? ?(find_vars_r): ... here.
> ? ? ? ?* tree-flow.h (find_referenced_vars_in): Declare.
> ? ? ? ?* tree-ssa-pre.c (create_expression_by_pieces): Assert
> ? ? ? ?that AVAIL_OUT exists for BLOCK.
> ? ? ? ?* Makefile.in (CGRAPH_H): Add dependency on cif-code.def
> ? ? ? ?(tree-loop-distribution.o): Fix dependency on TREE_VECTORIZER_H.
> ? ? ? ?(tree-parloops.o): Likewise.
>
> testsuite/ChangeLog
>
> ? ? ? ?* gcc.c-torture/execute/builtins/strlen-3.c: Fix ODR
> ? ? ? ?violation for variable 'inside_main'.
>
> Index: omp-low.c
> ===================================================================
> --- omp-low.c ? (revision 146277)
> +++ omp-low.c ? (working copy)
> @@ -1577,6 +1577,7 @@ create_omp_child_function (omp_context *
> ? t = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
> ? DECL_ARTIFICIAL (t) = 1;
> ? DECL_IGNORED_P (t) = 1;
> + ?DECL_CONTEXT (t) = decl;
> ? DECL_RESULT (decl) = t;
>
> ? t = build_decl (PARM_DECL, get_identifier (".omp_data_i"), ptr_type_node);
> Index: cgraphunit.c
> ===================================================================
> --- cgraphunit.c ? ? ? ?(revision 146277)
> +++ cgraphunit.c ? ? ? ?(working copy)
> @@ -1369,6 +1369,7 @@ cgraph_build_static_cdtor (char which, t
> ? resdecl = build_decl (RESULT_DECL, NULL_TREE, void_type_node);
> ? DECL_ARTIFICIAL (resdecl) = 1;
> ? DECL_RESULT (decl) = resdecl;
> + ?DECL_CONTEXT (resdecl) = decl;
>
> ? allocate_struct_function (decl, false);
>
> Index: testsuite/gcc.c-torture/execute/builtins/strlen-3.c
> ===================================================================
> --- testsuite/gcc.c-torture/execute/builtins/strlen-3.c (revision 146277)
> +++ testsuite/gcc.c-torture/execute/builtins/strlen-3.c (working copy)
> @@ -10,7 +10,7 @@ extern char *strcpy (char *, const char
> ?static const char bar[] = "Hello, World!";
> ?static const char baz[] = "hello, world?";
> ?static const char larger[20] = "short string";
> -extern volatile int inside_main;
> +extern int inside_main;
>
> ?int l1 = 1;
> ?int x = 6;
> Index: tree-dfa.c
> ===================================================================
> --- tree-dfa.c ?(revision 146277)
> +++ tree-dfa.c ?(working copy)
> @@ -88,26 +88,10 @@ find_referenced_vars (void)
> ? FOR_EACH_BB (bb)
> ? ? {
> ? ? ? for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
> - ? ? ? {
> - ? ? ? ? size_t i;
> - ? ? ? ? gimple stmt = gsi_stmt (si);
> - ? ? ? ? for (i = 0; i < gimple_num_ops (stmt); i++)
> - ? ? ? ? ? walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
> - ? ? ? }
> + ? ? ? find_referenced_vars_in (gsi_stmt (si));
>
> ? ? ? for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
> - ? ? ? {
> - ? ? ? ? gimple phi = gsi_stmt (si);
> - ? ? ? ? size_t i, len = gimple_phi_num_args (phi);
> -
> - ? ? ? ? walk_tree (gimple_phi_result_ptr (phi), find_vars_r, NULL, NULL);
> -
> - ? ? ? ? for (i = 0; i < len; i++)
> - ? ? ? ? ? {
> - ? ? ? ? ? ? tree arg = gimple_phi_arg_def (phi, i);
> - ? ? ? ? ? ? walk_tree (&arg, find_vars_r, NULL, NULL);
> - ? ? ? ? ? }
> - ? ? ? }
> + ? ? ? find_referenced_vars_in (gsi_stmt (si));
> ? ? }
>
> ? return 0;
> @@ -498,6 +482,33 @@ find_vars_r (tree *tp, int *walk_subtree
> ? return NULL_TREE;
> ?}
>
> +/* Find referenced variables in STMT. ?In contrast with
> + ? find_new_referenced_vars, this function will not mark newly found
> + ? variables for renaming. ?*/
> +
> +void
> +find_referenced_vars_in (gimple stmt)

Why export this function?  Are there outside uses on the branch?

> +{
> + ?size_t i;
> +
> + ?if (gimple_code (stmt) != GIMPLE_PHI)
> + ? ?{
> + ? ? ?for (i = 0; i < gimple_num_ops (stmt); i++)
> + ? ? ? walk_tree (gimple_op_ptr (stmt, i), find_vars_r, NULL, NULL);
> + ? ?}
> + ?else
> + ? ?{
> + ? ? ?walk_tree (gimple_phi_result_ptr (stmt), find_vars_r, NULL, NULL);
> +
> + ? ? ?for (i = 0; i < gimple_phi_num_args (stmt); i++)
> + ? ? ? {
> + ? ? ? ? tree arg = gimple_phi_arg_def (stmt, i);
> + ? ? ? ? walk_tree (&arg, find_vars_r, NULL, NULL);
> + ? ? ? }
> + ? ?}
> +}
> +
> +
> ?/* Lookup UID in the referenced_vars hashtable and return the associated
> ? ?variable. ?*/
>
> Index: tree-ssa-pre.c
> ===================================================================
> --- tree-ssa-pre.c ? ? ?(revision 146277)
> +++ tree-ssa-pre.c ? ? ?(working copy)
> @@ -3003,6 +3003,7 @@ create_expression_by_pieces (basic_block
> ? ? ? ? ? ? ?add_to_value (VN_INFO (forcedname)->value_id, nameexpr);
> ? ? ? ? ? ? ?if (!in_fre)
> ? ? ? ? ? ? ? ?bitmap_value_replace_in_set (NEW_SETS (block), nameexpr);
> + ? ? ? ? ? ? gcc_assert (AVAIL_OUT (block));

Uh.  That is odd.  We certainly do not test this in other places and AVAIL_OUT
is allocated for all blocks.

Thus, can you instead revert it on the branch (and now trunk)?

Thanks,
Richard.


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