This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
gcse store-motion problem and ACATS test c95072a
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: dberlin at dberlin dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 1 Sep 04 19:33:09 EDT
- Subject: gcse store-motion problem and ACATS test c95072a
We've been back and forth with this a number of times, but I think this is
the most direct way to fix the problem, which fundamentally is that you can't
move a store to a block where there wasn't a store previously due to having
an abnormal edge. Every way that both you and I tried to do it by affecting
the computation of stores didn't work, but this does, though it is somewhat
in the kludge category.
Tested on x86_64-linux-gnu.
Does this seem reasonable?
2004-09-01 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* gcse.c (pre_edge_insert): Minor cleanup.
(insert_store): Abort if asked to insert on abnormal edge.
(store_motion): If any edges that we'd have to put a store on
are abnormal, don't move the store.
*** gcse.c 18 Aug 2004 20:53:59 -0000 1.310
--- gcse.c 29 Aug 2004 21:32:54 -0000
*************** pre_edge_insert (struct edge_list *edge_
*** 4200,4204 ****
now. */
! if ((eg->flags & EDGE_ABNORMAL) == EDGE_ABNORMAL)
insert_insn_end_bb (index_map[j], bb, 0);
else
--- 4200,4204 ----
now. */
! if (eg->flags & EDGE_ABNORMAL)
insert_insn_end_bb (index_map[j], bb, 0);
else
*************** insert_store (struct ls_expr * expr, edg
*** 6224,6234 ****
}
! /* 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;
! }
insert_insn_on_edge (insn, e);
--- 6237,6244 ----
}
! /* 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. */
! if (e->flags & EDGE_ABNORMAL)
! abort ();
insert_insn_on_edge (insn, e);
*************** store_motion (void)
*** 6462,6465 ****
--- 6472,6494 ----
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))