https://gcc.gnu.org/g:3cdc8d7974e9c12aa8a2e585a4e177755ff08010

commit r17-558-g3cdc8d7974e9c12aa8a2e585a4e177755ff08010
Author: Andrew Pinski <[email protected]>
Date:   Fri May 15 15:01:50 2026 -0700

    ICF: Remove unneeded check for CASE_LABEL_EXPR
    
    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 <[email protected]>

Diff:
---
 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 4a95ae0bb9bc..0a3508170d4d 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;

Reply via email to