* [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared.
@ 2002-07-22 13:35 Daniel Berlin
2002-07-23 8:24 ` Diego Novillo
2002-07-27 5:48 ` Jason Merrill
0 siblings, 2 replies; 4+ messages in thread
From: Daniel Berlin @ 2002-07-22 13:35 UTC (permalink / raw)
To: gcc-patches
This fixes the problem i've been seeing where we'd end up with for loops
like:
for (T.4530 = la - lb; j <= T.4530; T.4530 = la - lb)
where the "T.4530 = la - lb" nodes were shared.
The cause is that tail_expression returns the same init_expr in both
cases, which is the shared.
Since we throw that directly in the EXPR_STMT_EXPR, we end up with a
shared node situation like above.
Now, the PRE result looks like:
for (T.4530 = pretmp.4753 = la - lb; j <= T.4530; T.4530 = pretmp.4753)
which is correct.
2002-07-22 Daniel Berlin <dberlin@dberlin.org>
* c-simplify.c (simplify_for_stmt): Deep copy the result of the
tail_expression, so it's unshared.
Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.7
diff -c -3 -p -w -B -b -r1.1.4.7 c-simplify.c
*** c-simplify.c 22 Jul 2002 07:44:09 -0000 1.1.4.7
--- c-simplify.c 22 Jul 2002 19:56:50 -0000
*************** simplify_for_stmt (stmt, pre_p)
*** 599,605 ****
add_tree (post_init_s, pre_p);
add_tree (deep_copy_list (pre_cond_s), pre_p);
! EXPR_STMT_EXPR (FOR_INIT_STMT (stmt)) = tail_expression (pre_p, 0);
/* Build the new FOR_COND. */
FOR_COND (stmt) = cond_s;
--- 599,605 ----
add_tree (post_init_s, pre_p);
add_tree (deep_copy_list (pre_cond_s), pre_p);
! EXPR_STMT_EXPR (FOR_INIT_STMT (stmt)) = deep_copy_list (tail_expression (pre_p, 0));
/* Build the new FOR_COND. */
FOR_COND (stmt) = cond_s;
*************** simplify_for_stmt (stmt, pre_p)
*** 615,621 ****
add_tree (post_expr_s, &expr_chain);
add_tree (pre_cond_s, &expr_chain);
! FOR_EXPR (stmt) = tail_expression (&expr_chain, 1);
if (expr_chain)
insert_before_continue_end (expr_chain, FOR_BODY (stmt));
--- 615,621 ----
add_tree (post_expr_s, &expr_chain);
add_tree (pre_cond_s, &expr_chain);
! FOR_EXPR (stmt) = deep_copy_list (tail_expression (&expr_chain, 1));
if (expr_chain)
insert_before_continue_end (expr_chain, FOR_BODY (stmt));
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared.
2002-07-22 13:35 [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared Daniel Berlin
@ 2002-07-23 8:24 ` Diego Novillo
2002-07-27 5:48 ` Jason Merrill
1 sibling, 0 replies; 4+ messages in thread
From: Diego Novillo @ 2002-07-23 8:24 UTC (permalink / raw)
To: Daniel Berlin; +Cc: gcc-patches
On Mon, 22 Jul 2002, Daniel Berlin wrote:
> 2002-07-22 Daniel Berlin <dberlin@dberlin.org>
>
> * c-simplify.c (simplify_for_stmt): Deep copy the result of the
> tail_expression, so it's unshared.
>
Looks fine. Please install after bootstrapping and regression
testing.
Thanks. Diego.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared.
2002-07-22 13:35 [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared Daniel Berlin
2002-07-23 8:24 ` Diego Novillo
@ 2002-07-27 5:48 ` Jason Merrill
2002-07-27 7:36 ` Daniel Berlin
1 sibling, 1 reply; 4+ messages in thread
From: Jason Merrill @ 2002-07-27 5:48 UTC (permalink / raw)
To: Daniel Berlin; +Cc: gcc-patches
You should only need to copy it the first time.
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared.
2002-07-27 5:48 ` Jason Merrill
@ 2002-07-27 7:36 ` Daniel Berlin
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Berlin @ 2002-07-27 7:36 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
On Sat, 27 Jul 2002, Jason Merrill wrote:
> You should only need to copy it the first time.
Then it would just be shared elsewhere (I tested this, and it was).
Remember, we are asking for a tree that is on the list of trees to add to
pre-conditions/etc.
Thus, it'll be added somewhere else *besides* EXPR_STMT_EXPR
(FOR_INIT_STMT) and FOR_EXPR (stmt).
If you don't copy it in both cases, one of them will still be shared.
>
> Jason
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-07-27 13:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-22 13:35 [tree-ssa-branch]: Patch to make sure simplified pieces of for_expr is unshared Daniel Berlin
2002-07-23 8:24 ` Diego Novillo
2002-07-27 5:48 ` Jason Merrill
2002-07-27 7:36 ` Daniel Berlin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).