public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/12] expr: Small optimization [PR102989]
@ 2023-08-09 18:15 Jakub Jelinek
  2023-08-10  7:18 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2023-08-09 18:15 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

Hi!

Small optimization to avoid testing modifier multiple times.

2023-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/102989
	* expr.cc (expand_expr_real_1) <case MEM_REF>: Add an early return for
	EXPAND_WRITE or EXPAND_MEMORY modifiers to avoid testing it multiple
	times.

--- gcc/expr.cc.jj	2023-08-08 15:55:06.499164554 +0200
+++ gcc/expr.cc	2023-08-08 15:59:36.594382141 +0200
@@ -11248,17 +11248,15 @@ expand_expr_real_1 (tree exp, rtx target
 	set_mem_addr_space (temp, as);
 	if (TREE_THIS_VOLATILE (exp))
 	  MEM_VOLATILE_P (temp) = 1;
-	if (modifier != EXPAND_WRITE
-	    && modifier != EXPAND_MEMORY
-	    && !inner_reference_p
+	if (modifier == EXPAND_WRITE || modifier == EXPAND_MEMORY)
+	  return temp;
+	if (!inner_reference_p
 	    && mode != BLKmode
 	    && align < GET_MODE_ALIGNMENT (mode))
 	  temp = expand_misaligned_mem_ref (temp, mode, unsignedp, align,
 					    modifier == EXPAND_STACK_PARM
 					    ? NULL_RTX : target, alt_rtl);
-	if (reverse
-	    && modifier != EXPAND_MEMORY
-	    && modifier != EXPAND_WRITE)
+	if (reverse)
 	  temp = flip_storage_order (mode, temp);
 	return temp;
       }

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/12] expr: Small optimization [PR102989]
  2023-08-09 18:15 [PATCH 1/12] expr: Small optimization [PR102989] Jakub Jelinek
@ 2023-08-10  7:18 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-08-10  7:18 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 9 Aug 2023, Jakub Jelinek wrote:

> Hi!
> 
> Small optimization to avoid testing modifier multiple times.

OK.

Richard.

> 2023-08-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c/102989
> 	* expr.cc (expand_expr_real_1) <case MEM_REF>: Add an early return for
> 	EXPAND_WRITE or EXPAND_MEMORY modifiers to avoid testing it multiple
> 	times.
> 
> --- gcc/expr.cc.jj	2023-08-08 15:55:06.499164554 +0200
> +++ gcc/expr.cc	2023-08-08 15:59:36.594382141 +0200
> @@ -11248,17 +11248,15 @@ expand_expr_real_1 (tree exp, rtx target
>  	set_mem_addr_space (temp, as);
>  	if (TREE_THIS_VOLATILE (exp))
>  	  MEM_VOLATILE_P (temp) = 1;
> -	if (modifier != EXPAND_WRITE
> -	    && modifier != EXPAND_MEMORY
> -	    && !inner_reference_p
> +	if (modifier == EXPAND_WRITE || modifier == EXPAND_MEMORY)
> +	  return temp;
> +	if (!inner_reference_p
>  	    && mode != BLKmode
>  	    && align < GET_MODE_ALIGNMENT (mode))
>  	  temp = expand_misaligned_mem_ref (temp, mode, unsignedp, align,
>  					    modifier == EXPAND_STACK_PARM
>  					    ? NULL_RTX : target, alt_rtl);
> -	if (reverse
> -	    && modifier != EXPAND_MEMORY
> -	    && modifier != EXPAND_WRITE)
> +	if (reverse)
>  	  temp = flip_storage_order (mode, temp);
>  	return temp;
>        }
> 
> 	Jakub
> 
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-10  7:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 18:15 [PATCH 1/12] expr: Small optimization [PR102989] Jakub Jelinek
2023-08-10  7:18 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).