Patchwork [C++] mem-ref2 merge, C++ gimplification change

login
register
mail settings
Submitter Richard Guenther
Date June 28, 2010, 11:14 a.m.
Message ID <alpine.LNX.2.00.1006281311510.1429@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/57131/
State New
Headers show

Comments

Richard Guenther - June 28, 2010, 11:14 a.m.
This is the only non-middle-end piece of the mem-ref2 merge.

As we iterate through cp_gimplify_expr on different states of
gimplification and still expect un-gimplified pieces we also
have to still expect INDIRECT_REFs.  So we can't use a predicate
that is supposed to match fully gimplified state.

Ok for trunk together with the mem-ref2 merge?

Thanks,
Richard.

	cp/
	* cp-gimplify.c (cp_gimplify_expr): Open-code the rhs
	predicate we are looking for, allow non-gimplified
	INDIRECT_REFs.
Jason Merrill - June 28, 2010, 2:45 p.m.
On 06/28/2010 07:14 AM, Richard Guenther wrote:
> +	else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1))

is_gimple_lvalue returns true for INDIRECT_REF, you don't need to check 
INDIRECT_REF_P as well.  OK with that change.

Jason
Richard Guenther - June 28, 2010, 2:52 p.m.
On Mon, 28 Jun 2010, Jason Merrill wrote:

> On 06/28/2010 07:14 AM, Richard Guenther wrote:
> > +	else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1))
> 
> is_gimple_lvalue returns true for INDIRECT_REF, you don't need to check
> INDIRECT_REF_P as well.  OK with that change.

It doesn't.  INDIRECT_REF isn't a valid gimple lvalue on the branch,
but you still see it here due to the call half-way inbetween
gimplifying.

Richard.
Jason Merrill - June 28, 2010, 4:12 p.m.
On 06/28/2010 10:52 AM, Richard Guenther wrote:
> On Mon, 28 Jun 2010, Jason Merrill wrote:
>
>> On 06/28/2010 07:14 AM, Richard Guenther wrote:
>>> +	else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1))
>>
>> is_gimple_lvalue returns true for INDIRECT_REF, you don't need to check
>> INDIRECT_REF_P as well.  OK with that change.
>
> It doesn't.  INDIRECT_REF isn't a valid gimple lvalue on the branch,
> but you still see it here due to the call half-way inbetween
> gimplifying.

Interesting.  OK.

Jason

Patch

Index: gcc/cp/cp-gimplify.c
===================================================================
--- gcc/cp/cp-gimplify.c	(.../trunk)	(revision 161367)
+++ gcc/cp/cp-gimplify.c	(.../branches/mem-ref2)	(revision 161369)
@@ -575,7 +575,7 @@  cp_gimplify_expr (tree *expr_p, gimple_s
 	  TREE_OPERAND (*expr_p, 1) = build1 (VIEW_CONVERT_EXPR,
 					      TREE_TYPE (op0), op1);
 
-	else if ((rhs_predicate_for (op0)) (op1)
+	else if ((is_gimple_lvalue (op1) || INDIRECT_REF_P (op1))
 		 && !(TREE_CODE (op1) == CALL_EXPR
 		      && CALL_EXPR_RETURN_SLOT_OPT (op1))
 		 && is_really_empty_class (TREE_TYPE (op0)))