Use CASE_CONVERT in a few more cases
Commit Message
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(-)
Comments
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
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);
@@ -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:
@@ -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)))
{
@@ -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)
@@ -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))
@@ -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);