aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2004-06-14 01:27:57 +0000
committerDaniel Berlin <dberlin@gcc.gnu.org>2004-06-14 01:27:57 +0000
commitce25943a4de8370b03133113eb9935f92fbc7a75 (patch)
tree14c168f85c8b4c078f80f0133136eaac2cd75da9
parentbd85b0cba676ce5dc076eec5146fd33575db40ec (diff)
downloadgcc-ce25943a4de8370b03133113eb9935f92fbc7a75.zip
gcc-ce25943a4de8370b03133113eb9935f92fbc7a75.tar.gz
gcc-ce25943a4de8370b03133113eb9935f92fbc7a75.tar.bz2
Fix PR tree-optimization/15979 Fix PR tree-optimization/15981
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. From-SVN: r83076
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-ssa-pre.c24
2 files changed, 26 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 54fe05f..a548afb6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2004-06-13 Daniel Berlin <dberlin@dberlin.org>
+
* tree-ssa-pre.c (add_to_value): is_gimple_min_invariant things
are available everywhere too.
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index b0d42ff..c285329 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -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;
@@ -1288,9 +1290,8 @@ insert_aux (basic_block block)
fprintf (dump_file, "Found fully redundant value\n");
continue;
}
-
-
- 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 +1302,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 +1342,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]);