+2014-11-07 Martin Liska <mliska@suse.cz>
+
+ PR ipa/63747
+ * ipa-icf-gimple.c (func_checker::compare_gimple_switch):
+ Missing checking for CASE_LOW and CASE_HIGH added.
+
2014-11-07 Martin Liska <mliska@suse.cz>
PR ipa/63595
tree label1 = gimple_switch_label (g1, i);
tree label2 = gimple_switch_label (g2, i);
+ /* Label LOW and HIGH comparison. */
+ tree low1 = CASE_LOW (label1);
+ tree low2 = CASE_LOW (label2);
+
+ if (!tree_int_cst_equal (low1, low2))
+ return return_false_with_msg ("case low values are different");
+
+ tree high1 = CASE_HIGH (label1);
+ tree high2 = CASE_HIGH (label2);
+
+ 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)
{
--- /dev/null
+/* { dg-options "-O2 -fdump-ipa-icf" } */
+/* { dg-do run } */
+
+static int __attribute__((noinline))
+foo(int i)
+{
+ switch (i)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+static int __attribute__((noinline))
+bar(int i)
+{
+ switch (i)
+ {
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+int main()
+{
+ return foo(0) + bar(4);
+}
+
+/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */
+/* { dg-final { cleanup-ipa-dump "icf" } } */