This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Cleanup and improvement of if-conversion for vectorization
On Thu, May 27, 2010 at 09:36, Richard Guenther <rguenther@suse.de> wrote:
> degenerate_phi_result () will return the degenerate value or NULL
> if the PHI node isn't degenerate.
Fixed like this. I will regstrap this on amd64-linux.
Ok for trunk?
Thanks,
Sebastian
From e509a00cb3ae9d8013c296cdb8ff0e9214c4218b Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Thu, 27 May 2010 10:21:46 -0500
Subject: [PATCH] Don't generate COND_EXPRs for degenerate_phi_result.
---
gcc/tree-if-conv.c | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index c338ecb..b20ef78 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -864,29 +864,35 @@ replace_phi_with_cond_gimple_assign_stmt (gimple phi, tree cond,
gimple new_stmt;
basic_block bb;
tree rhs;
- tree arg_0, arg_1;
+ tree arg, arg_0, arg_1;
gcc_assert (gimple_code (phi) == GIMPLE_PHI
&& gimple_phi_num_args (phi) == 2);
bb = gimple_bb (phi);
- /* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
- if (EDGE_PRED (bb, 1)->src == true_bb)
- {
- arg_0 = gimple_phi_arg_def (phi, 1);
- arg_1 = gimple_phi_arg_def (phi, 0);
- }
+ arg = degenerate_phi_result (phi);
+ if (arg)
+ rhs = arg;
else
{
- arg_0 = gimple_phi_arg_def (phi, 0);
- arg_1 = gimple_phi_arg_def (phi, 1);
- }
+ /* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
+ if (EDGE_PRED (bb, 1)->src == true_bb)
+ {
+ arg_0 = gimple_phi_arg_def (phi, 1);
+ arg_1 = gimple_phi_arg_def (phi, 0);
+ }
+ else
+ {
+ arg_0 = gimple_phi_arg_def (phi, 0);
+ arg_1 = gimple_phi_arg_def (phi, 1);
+ }
- /* Build new RHS using selected condition and arguments. */
- rhs = build3 (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)),
- unshare_expr (cond), unshare_expr (arg_0),
- unshare_expr (arg_1));
+ /* Build new RHS using selected condition and arguments. */
+ rhs = build3 (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)),
+ unshare_expr (cond), unshare_expr (arg_0),
+ unshare_expr (arg_1));
+ }
new_stmt = gimple_build_assign (unshare_expr (PHI_RESULT (phi)), rhs);
SSA_NAME_DEF_STMT (gimple_phi_result (phi)) = new_stmt;
--
1.7.0.4