This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR26447, ICE with load-PRE and java
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Daniel Berlin <dberlin at dberlin dot org>
- Date: Wed, 3 May 2006 22:37:51 +0200 (CEST)
- Subject: [PATCH] Fix PR26447, ICE with load-PRE and java
This patch fixes PR26447 by not inserting loads after a store that
can throw (and such causes verify_flow_info to fail), but instead
inserting an SSA_NAME copy before the store.
Bootstrapped and regtested on x86_64-unknown-linux-gnu together with
the FRE look-through-NOPs patch, all languages including Ada.
Ok for mainline? (Another variant of the patch, splitting the
basic_block for the inserted load also tested ok, if that is prefered)
Thanks,
Richard.
:ADDPATCH PRE:
2006-05-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/26447
* tree-ssa-pre.c (realify_fake_stores): For necessary loads
produce SSA_NAME copies before the store stmt to avoid
breaking exception handling.
Index: tree-ssa-pre.c
===================================================================
*** tree-ssa-pre.c (revision 113493)
--- tree-ssa-pre.c (working copy)
*************** realify_fake_stores (void)
*** 3290,3305 ****
/* Mark the temp variable as referenced */
add_referenced_tmp_var (SSA_NAME_VAR (TREE_OPERAND (stmt, 0)));
! /* Put the new statement in GC memory, fix up the annotation
! and SSA_NAME_DEF_STMT on it, and then put it in place of
! the old statement in the IR stream. */
! newstmt = unshare_expr (stmt);
SSA_NAME_DEF_STMT (TREE_OPERAND (newstmt, 0)) = newstmt;
!
! newstmt->common.ann = stmt->common.ann;
!
bsi = bsi_for_stmt (stmt);
! bsi_replace (&bsi, newstmt, true);
}
else
release_defs (stmt);
--- 3290,3308 ----
/* Mark the temp variable as referenced */
add_referenced_tmp_var (SSA_NAME_VAR (TREE_OPERAND (stmt, 0)));
! /* Put the new statement in GC memory, fix up the
! SSA_NAME_DEF_STMT on it, and then put it in place of
! the old statement before the store in the IR stream
! as a plain ssa name copy. */
! bsi = bsi_for_stmt (stmt);
! bsi_prev (&bsi);
! newstmt = build2 (MODIFY_EXPR, void_type_node,
! TREE_OPERAND (stmt, 0),
! TREE_OPERAND (bsi_stmt (bsi), 1));
SSA_NAME_DEF_STMT (TREE_OPERAND (newstmt, 0)) = newstmt;
! bsi_insert_before (&bsi, newstmt, BSI_SAME_STMT);
bsi = bsi_for_stmt (stmt);
! bsi_remove (&bsi, true);
}
else
release_defs (stmt);