* [PATCH] Fix PR44393
@ 2010-06-27 12:41 Richard Guenther
2010-06-27 12:50 ` [PATCH] Fix PR44393^W44684 Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2010-06-27 12:41 UTC (permalink / raw)
To: gcc-patches
My last fix caused some ICEs. So here we go making the thing
safe again and avoid some bogus calls into ref_may_alias_p_1.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2010-06-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44393
* tree-loop-distribution.c (generate_loops_for_partition): Fix
stmt removal and VOP renaming.
(generate_memset_zero): Remove redundant stmt updating.
* tree-flow.h (mark_virtual_ops_in_bb): Remove.
* tree-cfg.c (mark_virtual_ops_in_bb): Likewise.
* gcc.dg/pr44393.c: New testcase.
Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c (revision 161430)
--- gcc/tree-loop-distribution.c (working copy)
*************** generate_loops_for_partition (struct loo
*** 195,212 ****
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
! remove_phi_node (&bsi, true);
else
gsi_next (&bsi);
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
! if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
! && !bitmap_bit_p (partition, x++))
! gsi_remove (&bsi, false);
! else
! gsi_next (&bsi);
!
! mark_virtual_ops_in_bb (bb);
}
free (bbs);
--- 195,222 ----
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
! {
! gimple phi = gsi_stmt (bsi);
! if (!is_gimple_reg (gimple_phi_result (phi)))
! mark_virtual_phi_result_for_renaming (phi);
! remove_phi_node (&bsi, true);
! }
else
gsi_next (&bsi);
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
! {
! gimple stmt = gsi_stmt (bsi);
! if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
! && !bitmap_bit_p (partition, x++))
! {
! unlink_stmt_vdef (stmt);
! gsi_remove (&bsi, true);
! release_defs (stmt);
! }
! else
! gsi_next (&bsi);
! }
}
free (bbs);
*************** generate_memset_zero (gimple stmt, tree
*** 240,246 ****
gimple_seq stmt_list = NULL, stmts;
gimple fn_call;
tree mem, fn;
- gimple_stmt_iterator i;
struct data_reference *dr = XCNEW (struct data_reference);
location_t loc = gimple_location (stmt);
--- 250,255 ----
*************** generate_memset_zero (gimple stmt, tree
*** 291,303 ****
fn = build_fold_addr_expr (implicit_built_in_decls [BUILT_IN_MEMSET]);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
-
- for (i = gsi_start (stmt_list); !gsi_end_p (i); gsi_next (&i))
- {
- gimple s = gsi_stmt (i);
- update_stmt_if_modified (s);
- }
-
gsi_insert_seq_after (&bsi, stmt_list, GSI_CONTINUE_LINKING);
res = true;
--- 300,305 ----
Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h (revision 161430)
--- gcc/tree-flow.h (working copy)
*************** extern void end_recording_case_labels (v
*** 486,492 ****
extern basic_block move_sese_region_to_fn (struct function *, basic_block,
basic_block, tree);
void remove_edge_and_dominated_blocks (edge);
- void mark_virtual_ops_in_bb (basic_block);
bool tree_node_can_be_shared (tree);
/* In tree-cfgcleanup.c */
--- 486,491 ----
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c (revision 161430)
--- gcc/tree-cfg.c (working copy)
*************** move_stmt_r (gimple_stmt_iterator *gsi_p
*** 5792,5812 ****
return NULL_TREE;
}
- /* Marks virtual operands of all statements in basic blocks BBS for
- renaming. */
-
- void
- mark_virtual_ops_in_bb (basic_block bb)
- {
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
- }
-
/* Move basic block BB from function CFUN to function DEST_FN. The
block is moved out of the original linked list and placed after
block AFTER in the new list. Also, the block is removed from the
--- 5812,5817 ----
Index: gcc/testsuite/gcc.dg/pr44393.c
===================================================================
*** gcc/testsuite/gcc.dg/pr44393.c (revision 0)
--- gcc/testsuite/gcc.dg/pr44393.c (revision 0)
***************
*** 0 ****
--- 1,15 ----
+ /* { dg-do compile } */
+ /* { dg-options "-Os -ftree-loop-distribution" } */
+
+ int i;
+ void foo ()
+ {
+ int **pp = 0, *p = 0;
+ while (--i)
+ {
+ *p++ = 0;
+ *pp++ = p;
+ }
+ i = *p;
+ }
+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix PR44393^W44684
2010-06-27 12:41 [PATCH] Fix PR44393 Richard Guenther
@ 2010-06-27 12:50 ` Richard Guenther
0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2010-06-27 12:50 UTC (permalink / raw)
To: gcc-patches
On Sun, 27 Jun 2010, Richard Guenther wrote:
>
> My last fix caused some ICEs. So here we go making the thing
> safe again and avoid some bogus calls into ref_may_alias_p_1.
Err, that was the wrong patch and PR number.
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2010-06-26 Richard Guenther <rguenther@suse.de>
PR middle-end/44684
* tree-ssa-alias.c (refs_may_alias_p_1): Allow SSA name refs.
(stmt_may_clobber_ref_p_1): Do not bother to call the oracle
for register LHS. Or non-store assignments.
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c (revision 161435)
--- gcc/tree-ssa-alias.c (working copy)
*************** refs_may_alias_p_1 (ao_ref *ref1, ao_ref
*** 801,811 ****
--- 801,813 ----
alias_set_type set;
gcc_checking_assert ((!ref1->ref
+ || TREE_CODE (ref1->ref) == SSA_NAME
|| DECL_P (ref1->ref)
|| handled_component_p (ref1->ref)
|| INDIRECT_REF_P (ref1->ref)
|| TREE_CODE (ref1->ref) == TARGET_MEM_REF)
&& (!ref2->ref
+ || TREE_CODE (ref2->ref) == SSA_NAME
|| DECL_P (ref2->ref)
|| handled_component_p (ref2->ref)
|| INDIRECT_REF_P (ref2->ref)
*************** stmt_may_clobber_ref_p_1 (gimple stmt, a
*** 1409,1419 ****
return call_may_clobber_ref_p_1 (stmt, ref);
}
! else if (is_gimple_assign (stmt))
{
! ao_ref r;
! ao_ref_init (&r, gimple_assign_lhs (stmt));
! return refs_may_alias_p_1 (ref, &r, true);
}
else if (gimple_code (stmt) == GIMPLE_ASM)
return true;
--- 1411,1425 ----
return call_may_clobber_ref_p_1 (stmt, ref);
}
! else if (gimple_assign_single_p (stmt))
{
! tree lhs = gimple_assign_lhs (stmt);
! if (!is_gimple_reg (lhs))
! {
! ao_ref r;
! ao_ref_init (&r, gimple_assign_lhs (stmt));
! return refs_may_alias_p_1 (ref, &r, true);
! }
}
else if (gimple_code (stmt) == GIMPLE_ASM)
return true;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Fix PR44393
@ 2010-06-26 18:45 Richard Guenther
0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2010-06-26 18:45 UTC (permalink / raw)
To: gcc-patches
Quite some brokeness in loop distribution. This tries to fixup
what I noticed and it happens to fix the PR.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2010-06-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44393
* tree-loop-distribution.c (generate_loops_for_partition): Fix
stmt removal and VOP renaming.
(generate_memset_zero): Remove redundant stmt updating.
* tree-flow.h (mark_virtual_ops_in_bb): Remove.
* tree-cfg.c (mark_virtual_ops_in_bb): Likewise.
* gcc.dg/pr44393.c: New testcase.
Index: gcc/tree-loop-distribution.c
===================================================================
*** gcc/tree-loop-distribution.c (revision 161430)
--- gcc/tree-loop-distribution.c (working copy)
*************** generate_loops_for_partition (struct loo
*** 195,212 ****
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
! remove_phi_node (&bsi, true);
else
gsi_next (&bsi);
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
! if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
! && !bitmap_bit_p (partition, x++))
! gsi_remove (&bsi, false);
! else
! gsi_next (&bsi);
!
! mark_virtual_ops_in_bb (bb);
}
free (bbs);
--- 195,222 ----
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
! {
! gimple phi = gsi_stmt (bsi);
! if (!is_gimple_reg (gimple_phi_result (phi)))
! mark_virtual_phi_result_for_renaming (phi);
! remove_phi_node (&bsi, true);
! }
else
gsi_next (&bsi);
for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);)
! {
! gimple stmt = gsi_stmt (bsi);
! if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL
! && !bitmap_bit_p (partition, x++))
! {
! unlink_stmt_vdef (stmt);
! gsi_remove (&bsi, true);
! release_defs (stmt);
! }
! else
! gsi_next (&bsi);
! }
}
free (bbs);
*************** generate_memset_zero (gimple stmt, tree
*** 240,246 ****
gimple_seq stmt_list = NULL, stmts;
gimple fn_call;
tree mem, fn;
- gimple_stmt_iterator i;
struct data_reference *dr = XCNEW (struct data_reference);
location_t loc = gimple_location (stmt);
--- 250,255 ----
*************** generate_memset_zero (gimple stmt, tree
*** 291,303 ****
fn = build_fold_addr_expr (implicit_built_in_decls [BUILT_IN_MEMSET]);
fn_call = gimple_build_call (fn, 3, mem, integer_zero_node, nb_bytes);
gimple_seq_add_stmt (&stmt_list, fn_call);
-
- for (i = gsi_start (stmt_list); !gsi_end_p (i); gsi_next (&i))
- {
- gimple s = gsi_stmt (i);
- update_stmt_if_modified (s);
- }
-
gsi_insert_seq_after (&bsi, stmt_list, GSI_CONTINUE_LINKING);
res = true;
--- 300,305 ----
Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h (revision 161430)
--- gcc/tree-flow.h (working copy)
*************** extern void end_recording_case_labels (v
*** 486,492 ****
extern basic_block move_sese_region_to_fn (struct function *, basic_block,
basic_block, tree);
void remove_edge_and_dominated_blocks (edge);
- void mark_virtual_ops_in_bb (basic_block);
bool tree_node_can_be_shared (tree);
/* In tree-cfgcleanup.c */
--- 486,491 ----
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c (revision 161430)
--- gcc/tree-cfg.c (working copy)
*************** move_stmt_r (gimple_stmt_iterator *gsi_p
*** 5792,5812 ****
return NULL_TREE;
}
- /* Marks virtual operands of all statements in basic blocks BBS for
- renaming. */
-
- void
- mark_virtual_ops_in_bb (basic_block bb)
- {
- gimple_stmt_iterator gsi;
-
- for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
-
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- mark_virtual_ops_for_renaming (gsi_stmt (gsi));
- }
-
/* Move basic block BB from function CFUN to function DEST_FN. The
block is moved out of the original linked list and placed after
block AFTER in the new list. Also, the block is removed from the
--- 5812,5817 ----
Index: gcc/testsuite/gcc.dg/pr44393.c
===================================================================
*** gcc/testsuite/gcc.dg/pr44393.c (revision 0)
--- gcc/testsuite/gcc.dg/pr44393.c (revision 0)
***************
*** 0 ****
--- 1,15 ----
+ /* { dg-do compile } */
+ /* { dg-options "-Os -ftree-loop-distribution" } */
+
+ int i;
+ void foo ()
+ {
+ int **pp = 0, *p = 0;
+ while (--i)
+ {
+ *p++ = 0;
+ *pp++ = p;
+ }
+ i = *p;
+ }
+
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-27 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-27 12:41 [PATCH] Fix PR44393 Richard Guenther
2010-06-27 12:50 ` [PATCH] Fix PR44393^W44684 Richard Guenther
-- strict thread matches above, loose matches on Subject: below --
2010-06-26 18:45 [PATCH] Fix PR44393 Richard Guenther
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).