summaryrefslogtreecommitdiff
path: root/gcc/gcse.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-29 00:56:58 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2004-11-29 00:56:58 +0000
commit164aece45bf7f5b25120bc2bb5628bf93074f5c5 (patch)
tree4c0d3a61c11e170df36e960438ad28e74a1ff1f1 /gcc/gcse.c
parente90df7b3e09b9c9371c050bb2668f8665979deb0 (diff)
downloadgcc-164aece45bf7f5b25120bc2bb5628bf93074f5c5.tar.gz
* gcse.c (insert_store): Error if try to insert store on abnormal edge.
(store_motion): Don't move store if any edge we'd want to move it to is abnormal. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91447 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcse.c')
-rw-r--r--gcc/gcse.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/gcc/gcse.c b/gcc/gcse.c
index bddbbb4b574..dc3a01f85bc 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -4219,7 +4219,7 @@ pre_edge_insert (struct edge_list *edge_list, struct expr **index_map)
handling this situation. This one is easiest for
now. */
- if ((eg->flags & EDGE_ABNORMAL) == EDGE_ABNORMAL)
+ if (eg->flags & EDGE_ABNORMAL)
insert_insn_end_bb (index_map[j], bb, 0);
else
{
@@ -6220,13 +6220,9 @@ insert_store (struct ls_expr * expr, edge e)
return 0;
}
- /* We can't insert on this edge, so we'll insert at the head of the
- successors block. See Morgan, sec 10.5. */
- if ((e->flags & EDGE_ABNORMAL) == EDGE_ABNORMAL)
- {
- insert_insn_start_bb (insn, bb);
- return 0;
- }
+ /* We can't put stores in the front of blocks pointed to by abnormal
+ edges since that may put a store where one didn't used to be. */
+ gcc_assert (!(e->flags & EDGE_ABNORMAL));
insert_insn_on_edge (insn, e);
@@ -6490,6 +6486,25 @@ store_motion (void)
/* Now we want to insert the new stores which are going to be needed. */
for (ptr = first_ls_expr (); ptr != NULL; ptr = next_ls_expr (ptr))
{
+ /* If any of the edges we have above are abnormal, we can't move this
+ store. */
+ for (x = NUM_EDGES (edge_list) - 1; x >= 0; x--)
+ if (TEST_BIT (pre_insert_map[x], ptr->index)
+ && (INDEX_EDGE (edge_list, x)->flags & EDGE_ABNORMAL))
+ break;
+
+ if (x >= 0)
+ {
+ if (gcse_file != NULL)
+ fprintf (gcse_file,
+ "Can't replace store %d: abnormal edge from %d to %d\n",
+ ptr->index, INDEX_EDGE (edge_list, x)->src->index,
+ INDEX_EDGE (edge_list, x)->dest->index);
+ continue;
+ }
+
+ /* Now we want to insert the new stores which are going to be needed. */
+
FOR_EACH_BB (bb)
if (TEST_BIT (pre_delete_map[bb->index], ptr->index))
delete_store (ptr, bb);