aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2004-03-09 18:27:56 +0000
committerJeff Law <law@redhat.com>2004-03-09 18:27:56 +0000
commit43e57c5a8df35d383e661bea07c1ea72b2112b4e (patch)
treecbf8e47b028aa53f06549e836e4a5d7a417f3dc3
parent73f6f3229f24b825d3242741b6d1285fbdbfa055 (diff)
* tree-flow-inline.h (may_propagate_copy): Do not allow propagation of
a constant for a virtual operand. * gcc.c-torture/compile/20040309-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@79195 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog.tree-ssa5
-rw-r--r--gcc/testsuite/ChangeLog.tree-ssa4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040309-1.c20
-rw-r--r--gcc/tree-flow-inline.h27
4 files changed, 52 insertions, 4 deletions
diff --git a/gcc/ChangeLog.tree-ssa b/gcc/ChangeLog.tree-ssa
index 2cabc7aa0fc..f3feaecc112 100644
--- a/gcc/ChangeLog.tree-ssa
+++ b/gcc/ChangeLog.tree-ssa
@@ -1,3 +1,8 @@
+2004-03-09 Jeff Law <law@redhat.com>
+
+ * tree-flow-inline.h (may_propagate_copy): Do not allow propagation of
+ a constant for a virtual operand.
+
2004-03-08 Richard Henderson <rth@redhat.com>
* calls.c (initialize_argument_information): Add
diff --git a/gcc/testsuite/ChangeLog.tree-ssa b/gcc/testsuite/ChangeLog.tree-ssa
index 7af34094379..dbc9cd28bee 100644
--- a/gcc/testsuite/ChangeLog.tree-ssa
+++ b/gcc/testsuite/ChangeLog.tree-ssa
@@ -1,3 +1,7 @@
+2004-03-09 Jeff Law <law@redhat.com>
+
+ * gcc.c-torture/compile/20040309-1.c: New test.
+
2004-03-05 Jeff Law <law@redhat.com>
* gcc.dg/tree-ssa/20040305-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040309-1.c b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c
new file mode 100644
index 00000000000..df8390f207b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040309-1.c
@@ -0,0 +1,20 @@
+static const char default_tupleseps[] = ", \t";
+
+
+fubar (tupleseps)
+ const char *tupleseps;
+{
+ char *kp, *sp;
+ const char *septmp;
+ const char *tseplist;
+ tseplist = (tupleseps) ? tupleseps : default_tupleseps;
+ while (kp)
+ {
+ if (*tseplist)
+ septmp = tseplist;
+ bar (*septmp);
+ if (*tseplist)
+ if (*kp)
+ ;
+ }
+}
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index c48026000d8..3505b0c4f19 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -438,10 +438,29 @@ may_propagate_copy (tree dest, tree orig)
return false;
}
- /* We do not care about abnormal PHIs or user specified register
- declarations for virtual operands. */
- if (! is_gimple_reg (dest))
- return true;
+ /* If the destination is a SSA_NAME for a virtual operand, then we have
+ some special cases to handle. */
+ if (TREE_CODE (dest) == SSA_NAME && !is_gimple_reg (dest))
+ {
+ /* If both operands are SSA_NAMEs referring to virtual operands, then
+ we can always propagate. */
+ if (TREE_CODE (orig) == SSA_NAME)
+ {
+ if (!is_gimple_reg (orig))
+ return true;
+
+#ifdef ENABLE_CHECKING
+ /* If we have one real and one virtual operand, then something has
+ gone terribly wrong. */
+ if (is_gimple_reg (orig))
+ abort ();
+#endif
+ }
+
+ /* We have a "copy" from something like a constant into a virtual
+ operand. Reject these. */
+ return false;
+ }
return (!SSA_NAME_OCCURS_IN_ABNORMAL_PHI (dest)
&& (TREE_CODE (orig) != SSA_NAME