On Sat, May 16, 2026 at 5:36 AM Andrew Pinski
<[email protected]> wrote:
>
> I noticed there was a check to see gimple_switch_label
> returns a CASE_LABEL_EXPR after already using CASE_LOW/CASE_HIGH
> on the same value.
>
> This removes the check as it is always true.
>
> Bootstrapped and tested on x86_64-linux-gnu.

OK

> gcc/ChangeLog:
>
>         * ipa-icf-gimple.cc (func_checker::compare_gimple_switch): Remove
>         the check on CASE_LABEL_EXPR since it is redundant.
>
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
>  gcc/ipa-icf-gimple.cc | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/gcc/ipa-icf-gimple.cc b/gcc/ipa-icf-gimple.cc
> index 4a95ae0bb9b..0a3508170d4 100644
> --- a/gcc/ipa-icf-gimple.cc
> +++ b/gcc/ipa-icf-gimple.cc
> @@ -931,17 +931,8 @@ func_checker::compare_gimple_switch (const gswitch *g1, 
> const gswitch *g2)
>        if (!tree_int_cst_equal (high1, high2))
>         return return_false_with_msg ("case high values are different");
>
> -      if (TREE_CODE (label1) == CASE_LABEL_EXPR
> -         && TREE_CODE (label2) == CASE_LABEL_EXPR)
> -       {
> -         label1 = CASE_LABEL (label1);
> -         label2 = CASE_LABEL (label2);
> -
> -         if (!compare_operand (label1, label2, OP_NORMAL))
> -           return return_false_with_msg ("switch label_exprs are different");
> -       }
> -      else if (!tree_int_cst_equal (label1, label2))
> -       return return_false_with_msg ("switch labels are different");
> +      if (!compare_operand (CASE_LABEL (label1), CASE_LABEL (label2), 
> OP_NORMAL))
> +       return return_false_with_msg ("switch label_exprs are different");
>      }
>
>    return true;
> --
> 2.43.0
>

Reply via email to