]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ICF: Remove unneeded check for CASE_LABEL_EXPR
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 15 May 2026 22:01:50 +0000 (15:01 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sun, 17 May 2026 19:15:54 +0000 (12:15 -0700)
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.

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 <andrew.pinski@oss.qualcomm.com>
gcc/ipa-icf-gimple.cc

index 4a95ae0bb9bce2b9f0d02e282d419dcebd79e810..0a3508170d4d42f99bf026b4e191683dd3a5fbf0 100644 (file)
@@ -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;