summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-26 15:55:05 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-26 15:55:05 +0000
commitff24e1e2d718b2d5242fef97bc5b181eeaeb6fb9 (patch)
tree1c7125cd1c2808dabab6aadecd8045db06df02cb /gcc
parent6a69e8136b054143685286d32b04d4b765a57b26 (diff)
downloadgcc-ff24e1e2d718b2d5242fef97bc5b181eeaeb6fb9.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161434 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr44393.c15
-rw-r--r--gcc/tree-cfg.c15
-rw-r--r--gcc/tree-flow.h1
-rw-r--r--gcc/tree-loop-distribution.c34
6 files changed, 47 insertions, 32 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e0c312209ca..79a1182ca0f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2010-06-26 Jan Hubicka <jh@suse.cz>
* ipa-split.c (consider_split): PHI in entry block is OK as long as all
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 26d6cbc9a1c..3f88e7ddf85 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-26 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/44393
+ * gcc.dg/pr44393.c: New testcase.
+
2010-06-26 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/ipa-split-2.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/pr44393.c b/gcc/testsuite/gcc.dg/pr44393.c
new file mode 100644
index 00000000000..906d5932a0f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr44393.c
@@ -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;
+}
+
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 943aa5a9164..f28db37b7cb 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -5792,21 +5792,6 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
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
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index 3dd9244cef3..2d44c3c63b5 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -486,7 +486,6 @@ extern void end_recording_case_labels (void);
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 */
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 5379709261e..be1a1ee2058 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -195,18 +195,28 @@ generate_loops_for_partition (struct loop *loop, bitmap partition, bool copy_p)
for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi);)
if (!bitmap_bit_p (partition, x++))
- remove_phi_node (&bsi, true);
+ {
+ 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);)
- 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);
+ {
+ 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);
@@ -240,7 +250,6 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
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);
@@ -291,13 +300,6 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
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;