summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-10 16:48:42 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2011-01-10 16:48:42 +0000
commitc13d6d8f5f6dc7c57ada800e75f36080efeda6a4 (patch)
tree3414c4dc8a1eecc61ab246c7126be1ca6fb775d8
parenta15d5ede1b745b109884a8f94950aefc66836037 (diff)
downloadppe42-gcc-c13d6d8f5f6dc7c57ada800e75f36080efeda6a4.tar.gz
ppe42-gcc-c13d6d8f5f6dc7c57ada800e75f36080efeda6a4.zip
* PR tree-optimization/47141
* ipa-split.c (split_function): Handle case where we are returning a value and the return block has a virtual operand phi. * gcc.c-torture/compile/pr47141.c: New test. Approved by richie in IRC git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168634 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-split.c25
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr47141.c16
4 files changed, 45 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4eff7926d8c..b4446d6546c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-10 Jeff Law <law@redhat.com>
+
+ * PR tree-optimization/47141
+ * ipa-split.c (split_function): Handle case where we are
+ returning a value and the return block has a virtual operand phi.
+
2011-01-10 Jan Hubicka <jh@suse.cz>
PR tree-optimization/47234
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 4fcbfe940ba..ef6467b4e01 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -1016,20 +1016,31 @@ split_function (struct split_point *split_point)
e->probability = REG_BR_PROB_BASE;
e->count = new_return_bb->count;
bitmap_set_bit (split_point->split_bbs, new_return_bb->index);
- /* We change CFG in a way tree-inline is not able to compensate on while
- updating PHIs. There are only virtuals in return_bb, so recompute
- them. */
+ }
+ /* When we pass around the value, use existing return block. */
+ else
+ bitmap_set_bit (split_point->split_bbs, return_bb->index);
+
+ /* If RETURN_BB has virtual operand PHIs, they must be removed and the
+ virtual operand marked for renaming as we change the CFG in a way that
+ tree-inline is not able to compensate for.
+
+ Note this can happen whether or not we have a return value. If we have
+ a return value, then RETURN_BB may have PHIs for real operands too. */
+ if (return_bb != EXIT_BLOCK_PTR)
+ {
for (gsi = gsi_start_phis (return_bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
- gcc_assert (!is_gimple_reg (gimple_phi_result (stmt)));
+ if (is_gimple_reg (gimple_phi_result (stmt)))
+ {
+ gsi_next (&gsi);
+ continue;
+ }
mark_virtual_phi_result_for_renaming (stmt);
remove_phi_node (&gsi, true);
}
}
- /* When we pass aorund the value, use existing return block. */
- else
- bitmap_set_bit (split_point->split_bbs, return_bb->index);
/* Now create the actual clone. */
rebuild_cgraph_edges ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 91e6f7c8976..1b0d6f59b97 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-10 Jeff Law <law@redhat.com>
+
+ * PR tree-optimization/47141
+ * gcc.c-torture/compile/pr47141.c: New test.
+
2011-01-10 Eric Botcazou <ebotcazou@adacore.com>
PR testsuite/46230
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr47141.c b/gcc/testsuite/gcc.c-torture/compile/pr47141.c
new file mode 100644
index 00000000000..875e0fdd1c2
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr47141.c
@@ -0,0 +1,16 @@
+int
+foo (__UINTPTR_TYPE__ x)
+{
+ int a = 6;
+ int *b = &a;
+ if (x)
+ for (a = 0; a; a++)
+ ;
+ return a;
+}
+
+void
+bar (void)
+{
+ foo ((__UINTPTR_TYPE__) foo);
+}
OpenPOWER on IntegriCloud