re PR tree-optimization/62209 (ICE with LTO on valid code on x86_64-linux-gnu)

PR tree-optimization/62209
	* tree-ssa-reassoc.c (update_range_test): If stmt is a PHI and
	op == range->exp, insert seq and gimplified code after labels
	instead of after the phi.

From-SVN: r220706
This commit is contained in:
Jakub Jelinek 2015-02-14 09:23:18 +01:00 committed by Jakub Jelinek
parent b671235f79
commit 952e216e5a
2 changed files with 35 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2015-02-14 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/62209
* tree-ssa-reassoc.c (update_range_test): If stmt is a PHI and
op == range->exp, insert seq and gimplified code after labels
instead of after the phi.
2015-02-13 Jeff Law <law@redhat.com>
PR bootstrap/65060

View File

@ -2177,10 +2177,18 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange,
tem = fold_convert_loc (loc, optype, tem);
gsi = gsi_for_stmt (stmt);
unsigned int uid = gimple_uid (stmt);
/* In rare cases range->exp can be equal to lhs of stmt.
In that case we have to insert after the stmt rather then before
it. */
if (op == range->exp)
it. If stmt is a PHI, insert it at the start of the basic block. */
if (op != range->exp)
{
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true,
GSI_SAME_STMT);
gsi_prev (&gsi);
}
else if (gimple_code (stmt) != GIMPLE_PHI)
{
gsi_insert_seq_after (&gsi, seq, GSI_CONTINUE_LINKING);
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, false,
@ -2188,16 +2196,32 @@ update_range_test (struct range_entry *range, struct range_entry *otherrange,
}
else
{
gsi = gsi_after_labels (gimple_bb (stmt));
if (!gsi_end_p (gsi))
uid = gimple_uid (gsi_stmt (gsi));
else
{
gsi = gsi_start_bb (gimple_bb (stmt));
uid = 1;
while (!gsi_end_p (gsi))
{
uid = gimple_uid (gsi_stmt (gsi));
gsi_next (&gsi);
}
}
gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
tem = force_gimple_operand_gsi (&gsi, tem, true, NULL_TREE, true,
GSI_SAME_STMT);
gsi_prev (&gsi);
if (gsi_end_p (gsi))
gsi = gsi_last_bb (gimple_bb (stmt));
else
gsi_prev (&gsi);
}
for (; !gsi_end_p (gsi); gsi_prev (&gsi))
if (gimple_uid (gsi_stmt (gsi)))
break;
else
gimple_set_uid (gsi_stmt (gsi), gimple_uid (stmt));
gimple_set_uid (gsi_stmt (gsi), uid);
oe->op = tem;
range->exp = exp;