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 ipa-struct-reorg for VTA (PR debug/43084)


On Fri, Feb 19, 2010 at 7:18 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> As with other passes, debug stmts shouldn't affect the pass code generation
> decisions, and we shouldn't ICE on the debug stmts either.
> I think expressing peeled structures in debug info is very difficult
> problem, so pro tem. the patch just resets debug stmts related to aggregates
> that got peeled.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2010-02-19 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR debug/43084
> ? ? ? ?* ipa-struct-reorg.c (add_access_to_acc_sites): For debug stmts don't
> ? ? ? ?populate vars array.
> ? ? ? ?(create_new_general_access): For debug stmts just reset value.
> ? ? ? ?(get_stmt_accesses): For accesses within debug stmts just record them
> ? ? ? ?using add_access_to_acc_sites instead of preventing the peeling or
> ? ? ? ?counting them as accesses.
>
> ? ? ? ?* gcc.dg/pr43084.c: New test.
>
> --- gcc/ipa-struct-reorg.c.jj ? 2009-12-08 22:35:52.000000000 +0100
> +++ gcc/ipa-struct-reorg.c ? ? ?2010-02-19 15:37:13.000000000 +0100
> @@ -497,13 +497,16 @@ add_access_to_acc_sites (gimple stmt, tr
>
> ? ? ? ?acc = (struct access_site *) xmalloc (sizeof (struct access_site));
> ? ? ? ?acc->stmt = stmt;
> - ? ? ? acc->vars = VEC_alloc (tree, heap, 10);
> + ? ? ? if (!is_gimple_debug (stmt))
> + ? ? ? ?acc->vars = VEC_alloc (tree, heap, 10);
> + ? ? ? else
> + ? ? ? ?acc->vars = NULL;
> ? ? ? ?slot = htab_find_slot_with_hash (accs, stmt,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?htab_hash_pointer (stmt), INSERT);
> ? ? ? ?*slot = acc;
> -
> ? ? ?}
> - ? VEC_safe_push (tree, heap, acc->vars, var);
> + ? if (!is_gimple_debug (stmt))
> + ? ? VEC_safe_push (tree, heap, acc->vars, var);
> ?}
>
> ?/* This function adds NEW_DECL to function
> @@ -1383,6 +1386,13 @@ create_new_general_access (struct access
> ? ? ? create_new_stmts_for_cond_expr (stmt);
> ? ? ? break;
>
> + ? ?case GIMPLE_DEBUG:
> + ? ? ?/* It is very hard to maintain usable debug info after struct peeling,
> + ? ? ? ?for now just reset all debug stmts referencing objects that have
> + ? ? ? ?been peeled. ?*/
> + ? ? ?gimple_debug_bind_reset_value (stmt);
> + ? ? ?break;
> +
> ? ? default:
> ? ? ? create_new_stmts_for_general_acc (acc, str);
> ? ? }
> @@ -2494,6 +2504,15 @@ get_stmt_accesses (tree *tp, int *walk_s
>
> ? ? ? ?if (i != VEC_length (structure, structures))
> ? ? ? ? ?{
> + ? ? ? ? ? if (is_gimple_debug (stmt))
> + ? ? ? ? ? ? {
> + ? ? ? ? ? ? ? d_str str;
> +
> + ? ? ? ? ? ? ? str = VEC_index (structure, structures, i);
> + ? ? ? ? ? ? ? add_access_to_acc_sites (stmt, NULL, str->accs);
> + ? ? ? ? ? ? ? *walk_subtrees = 0;
> + ? ? ? ? ? ? ? break;
> + ? ? ? ? ? ? }
> ? ? ? ? ? ?if (dump_file)
> ? ? ? ? ? ? ?{
> ? ? ? ? ? ? ? ?fprintf (dump_file, "\nThe type ");
> @@ -2525,6 +2544,13 @@ get_stmt_accesses (tree *tp, int *walk_s
> ? ? ? ? ? ? ? ?struct field_entry * field =
> ? ? ? ? ? ? ? ? ?find_field_in_struct (str, field_decl);
>
> + ? ? ? ? ? ? ? if (is_gimple_debug (stmt))
> + ? ? ? ? ? ? ? ? {
> + ? ? ? ? ? ? ? ? ? add_access_to_acc_sites (stmt, NULL, str->accs);
> + ? ? ? ? ? ? ? ? ? *walk_subtrees = 0;
> + ? ? ? ? ? ? ? ? ? break;
> + ? ? ? ? ? ? ? ? }
> +
> ? ? ? ? ? ? ? ?if (field)
> ? ? ? ? ? ? ? ? ?{
> ? ? ? ? ? ? ? ? ? ?struct field_access_site *acc = make_field_acc_node ();
> --- gcc/testsuite/gcc.dg/pr43084.c.jj ? 2010-02-19 15:53:58.000000000 +0100
> +++ gcc/testsuite/gcc.dg/pr43084.c ? ? ?2010-02-19 15:53:41.000000000 +0100
> @@ -0,0 +1,16 @@
> +/* PR debug/43084 */
> +/* { dg-do compile } */
> +/* { dg-options "-O1 -fipa-struct-reorg -fwhole-program -fipa-type-escape -fcompare-debug" } */
> +
> +struct S
> +{
> + ?int a;
> +};
> +
> +int
> +main ()
> +{
> + ?struct S s;
> + ?struct S *p = &s;
> + ?return p->a;
> +}
>
> ? ? ? ?Jakub
>


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