This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR 15979, 15981
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: belyshev at lubercy dot com
- Date: Sun, 13 Jun 2004 20:13:01 -0400
- Subject: [PATCH] Fix PR 15979, 15981
Stupid coding mistake.
There didn't used to be an inner loop there, so the continue used to
jump to the next expression, instead of the next predecessor.
I forgot to change it to do a break + test when i added the inner loop
it is in.
I'll commit as soon as bootstrap + make check passes.
2004-06-13 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/15979
Fix PR tree-optimization/15981
* tree-ssa-pre.c (insert_aux): Fix faulty logic so that we don't
try to insert values undefined along some path.
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
retrieving revision 2.8
diff -u -3 -p -r2.8 tree-ssa-pre.c
--- tree-ssa-pre.c 13 Jun 2004 22:52:34 -0000 2.8
+++ tree-ssa-pre.c 14 Jun 2004 00:05:17 -0000
@@ -1279,6 +1279,8 @@ insert_aux (basic_block block)
edge pred;
basic_block bprime;
tree eprime;
+ bool cant_insert = false;
+
val = get_value_handle (node->expr);
if (set_contains_value (PHI_GEN (block), val))
continue;
@@ -1290,7 +1292,7 @@ insert_aux (basic_block block)
}
- avail = xcalloc (last_basic_block, sizeof (tree));
+ avail = xcalloc (last_basic_block, sizeof (tree));
for (pred = block->pred;
pred;
pred = pred->pred_next)
@@ -1301,8 +1303,21 @@ insert_aux (basic_block block)
eprime = phi_translate (node->expr,
ANTIC_IN (block),
bprime, block);
+
+ /* eprime will generally only be NULL if the
+ value of the expression, translated
+ through the PHI for this predecessor, is
+ undefined. If that is the case, we can't
+ make the expression fully redundant,
+ because its value is undefined along a
+ predecessor path. We can thus break out
+ early because it doesn't matter what the
+ rest of the results are. */
if (eprime == NULL)
- continue;
+ {
+ cant_insert = true;
+ break;
+ }
vprime = get_value_handle (eprime);
if (!vprime)
@@ -1328,7 +1343,7 @@ insert_aux (basic_block block)
}
}
- if (!all_same && by_some)
+ if (!cant_insert && !all_same && by_some)
{
tree temp;
tree type = TREE_TYPE (avail[block->pred->src->index]);