This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Fix PR46029: reimplement if-convert stores.


On Mon, Jan 3, 2011 at 15:39, Richard Guenther
<richard.guenther@gmail.com> wrote:
> walk_stmt_load_store_addr_ops needs to handle COND_EXPRs in
> the gimple_assign_single_p () visit_addr case.
>
> Of course COND_EXPRs should be moved to non-single RHS at some point.

The attached patch fixes the problems I was seeing.
I will test again the fix for PR46029 with this patch on top and I
will repost it.

Thanks for your help,
Sebastian
From 3ffab79f5fd56a6578fb2e38035275b759729a3f Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Mon, 3 Jan 2011 17:06:56 -0600
Subject: [PATCH] Handle COND_EXPR in walk_stmt_load_store_addr_ops.

---
 gcc/gimple.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gcc/gimple.c b/gcc/gimple.c
index e686e63..dab819a 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -4931,6 +4931,20 @@ walk_stmt_load_store_addr_ops (gimple stmt, void *data,
 		   && TREE_CODE (OBJ_TYPE_REF_OBJECT (rhs)) == ADDR_EXPR)
 	    ret |= visit_addr (stmt, TREE_OPERAND (OBJ_TYPE_REF_OBJECT (rhs),
 						   0), data);
+	  /* FIXME: COND_EXPR should be moved to non-single RHS at
+	     some point.  */
+	  else if (TREE_CODE (rhs) == COND_EXPR)
+	    {
+	      tree op1 = TREE_OPERAND (rhs, 1);
+	      tree op2 = TREE_OPERAND (rhs, 2);
+
+	      if (TREE_CODE (op1) == ADDR_EXPR)
+		ret |= visit_addr (stmt, TREE_OPERAND (op1, 0), data);
+
+	      if (TREE_CODE (op2) == ADDR_EXPR)
+		ret |= visit_addr (stmt, TREE_OPERAND (op2, 0), data);
+	    }
+
           lhs = gimple_assign_lhs (stmt);
 	  if (TREE_CODE (lhs) == TARGET_MEM_REF
               && TREE_CODE (TMR_BASE (lhs)) == ADDR_EXPR)
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]