summaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-28 19:48:19 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-28 19:48:19 +0000
commit296c44f8471bf10dd1e9acd1125ce51bc29c7123 (patch)
treebc3381be110ff36127771fa97b896f92ce969b52 /gcc/tree-if-conv.c
parentad0d0af826df213ad074a087bf21d837c58047db (diff)
downloadgcc-296c44f8471bf10dd1e9acd1125ce51bc29c7123.tar.gz
PR tree-optimization/34140
* tree-if-conv.c (if_convertible_phi_p): Fail if BB other than loop->header has virtual phi nodes. * gcc.c-torture/compile/20071128-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 324fc93e189..ec349297fd1 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -302,7 +302,8 @@ tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond,
and it belongs to basic block BB.
PHI is not if-convertible
- if it has more than 2 arguments.
- - Virtual PHI is immediately used in another PHI node. */
+ - Virtual PHI is immediately used in another PHI node.
+ - Virtual PHI on BB other than header. */
static bool
if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
@@ -324,6 +325,13 @@ if_convertible_phi_p (struct loop *loop, basic_block bb, tree phi)
{
imm_use_iterator imm_iter;
use_operand_p use_p;
+
+ if (bb != loop->header)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Virtual phi not on loop header.\n");
+ return false;
+ }
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, PHI_RESULT (phi))
{
if (TREE_CODE (USE_STMT (use_p)) == PHI_NODE)