public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Use CASE_CONVERT in a few more cases
@ 2022-04-29  9:37 Richard Biener
  2022-04-29 15:30 ` Jeff Law
  2022-04-29 18:30 ` Jason Merrill
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Biener @ 2022-04-29  9:37 UTC (permalink / raw)
  To: gcc-patches


This uses CASE_CONVERT more which eases eventual removal of NOP_EXPR.

Bootstrapped and tested on x86_64-unknown-linux-gnu, OK for trunk?

Jason, from the experiment this is from I know that the C++ FE
distinguishes between CONVERT_EXPR and NOP_EXPR at the moment,
are the C++ bits nevertheless OK?

2022-04-29  Richard Biener  <rguenther@suse.de>

	cp/
	* constexpr.cc (fold_simple_1): Use CASE_CONVERT.
	* cp-gimplify.cc (cp_fold): Likewise.
	* pt.cc (tsubst_copy): Likewise.

	* dojump.cc (do_jump): Use CASE_CONVERT.
	* tree-ssa-dom.cc (edge_info::derive_equivalences): Likewise.
---
 gcc/cp/constexpr.cc   | 3 +--
 gcc/cp/cp-gimplify.cc | 3 +--
 gcc/cp/pt.cc          | 3 +--
 gcc/dojump.cc         | 4 +---
 gcc/tree-ssa-dom.cc   | 3 +--
 5 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 47d5113ace2..c40efa6cc4e 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -8016,9 +8016,8 @@ fold_simple_1 (tree t)
     case NEGATE_EXPR:
     case BIT_NOT_EXPR:
     case TRUTH_NOT_EXPR:
-    case NOP_EXPR:
     case VIEW_CONVERT_EXPR:
-    case CONVERT_EXPR:
+    CASE_CONVERT:
     case FLOAT_EXPR:
     case FIX_TRUNC_EXPR:
     case FIXED_CONVERT_EXPR:
diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
index e4c2644af15..b52d9cb5754 100644
--- a/gcc/cp/cp-gimplify.cc
+++ b/gcc/cp/cp-gimplify.cc
@@ -2451,9 +2451,8 @@ cp_fold (tree x)
     case VIEW_CONVERT_EXPR:
       rval_ops = false;
       /* FALLTHRU */
-    case CONVERT_EXPR:
-    case NOP_EXPR:
     case NON_LVALUE_EXPR:
+    CASE_CONVERT:
 
       if (VOID_TYPE_P (TREE_TYPE (x)))
 	{
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 81f7ef5c42b..83600d52b33 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -17152,8 +17152,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
     case STATIC_CAST_EXPR:
     case DYNAMIC_CAST_EXPR:
     case IMPLICIT_CONV_EXPR:
-    case CONVERT_EXPR:
-    case NOP_EXPR:
+    CASE_CONVERT:
       {
 	tsubst_flags_t tcomplain = complain;
 	if (code == CAST_EXPR)
diff --git a/gcc/dojump.cc b/gcc/dojump.cc
index 0c880d65338..17a73da7448 100644
--- a/gcc/dojump.cc
+++ b/gcc/dojump.cc
@@ -421,14 +421,12 @@ do_jump (tree exp, rtx_code_label *if_false_label,
       break;
 #endif
 
-    case NOP_EXPR:
+    CASE_CONVERT:
       if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
           || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
           || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_REF
           || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_RANGE_REF)
         goto normal;
-      /* FALLTHRU */
-    case CONVERT_EXPR:
       /* If we are narrowing the operand, we have to do the compare in the
          narrower mode.  */
       if ((TYPE_PRECISION (TREE_TYPE (exp))
diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
index 4a0cf2ef54c..89b05171d57 100644
--- a/gcc/tree-ssa-dom.cc
+++ b/gcc/tree-ssa-dom.cc
@@ -220,8 +220,7 @@ edge_info::derive_equivalences (tree name, tree value, int recursion_limit)
 	/* If LHS is an SSA_NAME and RHS is a constant integer and LHS was
 	   set via a widening type conversion, then we may be able to record
 	   additional equivalences.  */
-	case NOP_EXPR:
-	case CONVERT_EXPR:
+	CASE_CONVERT:
 	  {
 	    tree rhs = gimple_assign_rhs1 (def_stmt);
 	    tree rhs_type = TREE_TYPE (rhs);
-- 
2.34.1

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

* Re: [PATCH] Use CASE_CONVERT in a few more cases
  2022-04-29  9:37 [PATCH] Use CASE_CONVERT in a few more cases Richard Biener
@ 2022-04-29 15:30 ` Jeff Law
  2022-04-29 18:30 ` Jason Merrill
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2022-04-29 15:30 UTC (permalink / raw)
  To: gcc-patches



On 4/29/2022 3:37 AM, Richard Biener via Gcc-patches wrote:
> This uses CASE_CONVERT more which eases eventual removal of NOP_EXPR.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK for trunk?
>
> Jason, from the experiment this is from I know that the C++ FE
> distinguishes between CONVERT_EXPR and NOP_EXPR at the moment,
> are the C++ bits nevertheless OK?
>
> 2022-04-29  Richard Biener  <rguenther@suse.de>
>
> 	cp/
> 	* constexpr.cc (fold_simple_1): Use CASE_CONVERT.
> 	* cp-gimplify.cc (cp_fold): Likewise.
> 	* pt.cc (tsubst_copy): Likewise.
>
> 	* dojump.cc (do_jump): Use CASE_CONVERT.
> 	* tree-ssa-dom.cc (edge_info::derive_equivalences): Likewise.
The dojump and tree-ssa-dom bits are fine.

jeff


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

* Re: [PATCH] Use CASE_CONVERT in a few more cases
  2022-04-29  9:37 [PATCH] Use CASE_CONVERT in a few more cases Richard Biener
  2022-04-29 15:30 ` Jeff Law
@ 2022-04-29 18:30 ` Jason Merrill
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2022-04-29 18:30 UTC (permalink / raw)
  To: Richard Biener, gcc-patches

On 4/29/22 05:37, Richard Biener wrote:
> 
> This uses CASE_CONVERT more which eases eventual removal of NOP_EXPR.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu, OK for trunk?
> 
> Jason, from the experiment this is from I know that the C++ FE
> distinguishes between CONVERT_EXPR and NOP_EXPR at the moment,
> are the C++ bits nevertheless OK?

Yes.

> 2022-04-29  Richard Biener  <rguenther@suse.de>
> 
> 	cp/
> 	* constexpr.cc (fold_simple_1): Use CASE_CONVERT.
> 	* cp-gimplify.cc (cp_fold): Likewise.
> 	* pt.cc (tsubst_copy): Likewise.
> 
> 	* dojump.cc (do_jump): Use CASE_CONVERT.
> 	* tree-ssa-dom.cc (edge_info::derive_equivalences): Likewise.
> ---
>   gcc/cp/constexpr.cc   | 3 +--
>   gcc/cp/cp-gimplify.cc | 3 +--
>   gcc/cp/pt.cc          | 3 +--
>   gcc/dojump.cc         | 4 +---
>   gcc/tree-ssa-dom.cc   | 3 +--
>   5 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
> index 47d5113ace2..c40efa6cc4e 100644
> --- a/gcc/cp/constexpr.cc
> +++ b/gcc/cp/constexpr.cc
> @@ -8016,9 +8016,8 @@ fold_simple_1 (tree t)
>       case NEGATE_EXPR:
>       case BIT_NOT_EXPR:
>       case TRUTH_NOT_EXPR:
> -    case NOP_EXPR:
>       case VIEW_CONVERT_EXPR:
> -    case CONVERT_EXPR:
> +    CASE_CONVERT:
>       case FLOAT_EXPR:
>       case FIX_TRUNC_EXPR:
>       case FIXED_CONVERT_EXPR:
> diff --git a/gcc/cp/cp-gimplify.cc b/gcc/cp/cp-gimplify.cc
> index e4c2644af15..b52d9cb5754 100644
> --- a/gcc/cp/cp-gimplify.cc
> +++ b/gcc/cp/cp-gimplify.cc
> @@ -2451,9 +2451,8 @@ cp_fold (tree x)
>       case VIEW_CONVERT_EXPR:
>         rval_ops = false;
>         /* FALLTHRU */
> -    case CONVERT_EXPR:
> -    case NOP_EXPR:
>       case NON_LVALUE_EXPR:
> +    CASE_CONVERT:
>   
>         if (VOID_TYPE_P (TREE_TYPE (x)))
>   	{
> diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
> index 81f7ef5c42b..83600d52b33 100644
> --- a/gcc/cp/pt.cc
> +++ b/gcc/cp/pt.cc
> @@ -17152,8 +17152,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
>       case STATIC_CAST_EXPR:
>       case DYNAMIC_CAST_EXPR:
>       case IMPLICIT_CONV_EXPR:
> -    case CONVERT_EXPR:
> -    case NOP_EXPR:
> +    CASE_CONVERT:
>         {
>   	tsubst_flags_t tcomplain = complain;
>   	if (code == CAST_EXPR)
> diff --git a/gcc/dojump.cc b/gcc/dojump.cc
> index 0c880d65338..17a73da7448 100644
> --- a/gcc/dojump.cc
> +++ b/gcc/dojump.cc
> @@ -421,14 +421,12 @@ do_jump (tree exp, rtx_code_label *if_false_label,
>         break;
>   #endif
>   
> -    case NOP_EXPR:
> +    CASE_CONVERT:
>         if (TREE_CODE (TREE_OPERAND (exp, 0)) == COMPONENT_REF
>             || TREE_CODE (TREE_OPERAND (exp, 0)) == BIT_FIELD_REF
>             || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_REF
>             || TREE_CODE (TREE_OPERAND (exp, 0)) == ARRAY_RANGE_REF)
>           goto normal;
> -      /* FALLTHRU */
> -    case CONVERT_EXPR:
>         /* If we are narrowing the operand, we have to do the compare in the
>            narrower mode.  */
>         if ((TYPE_PRECISION (TREE_TYPE (exp))
> diff --git a/gcc/tree-ssa-dom.cc b/gcc/tree-ssa-dom.cc
> index 4a0cf2ef54c..89b05171d57 100644
> --- a/gcc/tree-ssa-dom.cc
> +++ b/gcc/tree-ssa-dom.cc
> @@ -220,8 +220,7 @@ edge_info::derive_equivalences (tree name, tree value, int recursion_limit)
>   	/* If LHS is an SSA_NAME and RHS is a constant integer and LHS was
>   	   set via a widening type conversion, then we may be able to record
>   	   additional equivalences.  */
> -	case NOP_EXPR:
> -	case CONVERT_EXPR:
> +	CASE_CONVERT:
>   	  {
>   	    tree rhs = gimple_assign_rhs1 (def_stmt);
>   	    tree rhs_type = TREE_TYPE (rhs);


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

end of thread, other threads:[~2022-04-29 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29  9:37 [PATCH] Use CASE_CONVERT in a few more cases Richard Biener
2022-04-29 15:30 ` Jeff Law
2022-04-29 18:30 ` Jason Merrill

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).