summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authordpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 18:25:01 +0000
committerdpatel <dpatel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 18:25:01 +0000
commit5f4df34e57a3bca40bd36e7cbe1e0cf6306b511c (patch)
tree5cfc3a71e600025c3a8c8f119a5b0f1e54281ac7 /gcc
parent0367212f273e24b15f62b0355206368744e80ae2 (diff)
downloadgcc-5f4df34e57a3bca40bd36e7cbe1e0cf6306b511c.tar.gz
* tree-if-conv.c (find_phi_replacement_condition): Return true edge block.
(replace_phi_with_cond_modify_expr): Select conditional expr args based on true edge basic block. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87194 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-if-conv.c34
2 files changed, 23 insertions, 17 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 348924547ca..3108964bfa2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-08 Devang Patel <dpatel@apple.com>
+
+ * tree-if-conv.c (find_phi_replacement_condition): Return true edge block.
+ (replace_phi_with_cond_modify_expr): Select conditional expr args based on
+ true edge basic block.
+
2004-09-08 Jan Hubicka <jh@suse.cz>
* tree-ssa-operands.c (add_stmt_operand): Use V_MUST_DEF even for
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index daca885f64a..1e2fd76e3a9 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -117,9 +117,9 @@ static void add_to_predicate_list (basic_block, tree);
static tree add_to_dst_predicate_list (struct loop * loop, tree, tree, tree,
block_stmt_iterator *);
static void clean_predicate_lists (struct loop *loop);
-static bool find_phi_replacement_condition (basic_block, tree *,
- block_stmt_iterator *);
-static void replace_phi_with_cond_modify_expr (tree, tree, bool,
+static basic_block find_phi_replacement_condition (basic_block, tree *,
+ block_stmt_iterator *);
+static void replace_phi_with_cond_modify_expr (tree, tree, basic_block,
block_stmt_iterator *);
static void process_phi_nodes (struct loop *);
static void combine_blocks (struct loop *);
@@ -671,17 +671,17 @@ clean_predicate_lists (struct loop *loop)
}
/* Basic block BB has two predecessors. Using predecessor's aux field, set
- appropriate condition COND for the PHI node replacement. Return true if
- phi arguments are condition is selected from second predecessor. */
+ appropriate condition COND for the PHI node replacement. Return true block
+ whose phi arguments are selected when cond is true. */
-static bool
+static basic_block
find_phi_replacement_condition (basic_block bb, tree *cond,
block_stmt_iterator *bsi)
{
edge e;
basic_block p1 = NULL;
basic_block p2 = NULL;
- bool switch_args = false;
+ basic_block true_bb = NULL;
tree tmp_cond;
for (e = bb->pred; e; e = e->pred_next)
@@ -700,12 +700,12 @@ find_phi_replacement_condition (basic_block bb, tree *cond,
if (TREE_CODE (tmp_cond) == TRUTH_NOT_EXPR)
{
*cond = p2->aux;
- switch_args = true;
+ true_bb = p2;
}
else
{
*cond = p1->aux;
- switch_args = false;
+ true_bb = p1;
}
/* Create temp. for the condition. Vectorizer prefers to have gimple
@@ -727,7 +727,7 @@ find_phi_replacement_condition (basic_block bb, tree *cond,
abort ();
#endif
- return switch_args;
+ return true_bb;
}
@@ -738,18 +738,18 @@ find_phi_replacement_condition (basic_block bb, tree *cond,
is converted into,
S2: A = cond ? x1 : x2;
S2 is inserted at the top of basic block's statement list.
- PHI arguments are switched if SWITCH_ARGS is true.
+ When COND is true, phi arg from TRUE_BB is selected.
*/
static void
-replace_phi_with_cond_modify_expr (tree phi, tree cond, bool switch_args,
+replace_phi_with_cond_modify_expr (tree phi, tree cond, basic_block true_bb,
block_stmt_iterator *bsi)
{
tree new_stmt;
basic_block bb;
tree rhs;
tree arg_0, arg_1;
-
+
#ifdef ENABLE_CHECKING
if (TREE_CODE (phi) != PHI_NODE)
abort ();
@@ -767,7 +767,7 @@ replace_phi_with_cond_modify_expr (tree phi, tree cond, bool switch_args,
arg_1 = NULL_TREE;
/* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
- if (switch_args)
+ if (PHI_ARG_EDGE(phi, 1)->src == true_bb)
{
arg_0 = PHI_ARG_DEF (phi, 1);
arg_1 = PHI_ARG_DEF (phi, 0);
@@ -820,7 +820,7 @@ process_phi_nodes (struct loop *loop)
{
tree phi, cond;
block_stmt_iterator bsi;
- bool switch_args = false;
+ basic_block true_bb = NULL;
bb = ifc_bbs[i];
if (bb == loop->header || bb == loop->latch)
@@ -832,12 +832,12 @@ process_phi_nodes (struct loop *loop)
/* BB has two predecessors. Using predecessor's aux field, set
appropriate condition for the PHI node replacement. */
if (phi)
- switch_args = find_phi_replacement_condition (bb, &cond, &bsi);
+ true_bb = find_phi_replacement_condition (bb, &cond, &bsi);
while (phi)
{
tree next = TREE_CHAIN (phi);
- replace_phi_with_cond_modify_expr (phi, cond, switch_args, &bsi);
+ replace_phi_with_cond_modify_expr (phi, cond, true_bb, &bsi);
release_phi_node (phi);
phi = next;
}