The following two patches should address all issues regarding to
alias analysis, restrict and ICF.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2015-03-04  Richard Biener  <rguent...@suse.de>

        PR ipa/65270
        * ipa-icf-gimple.c (func_checker::compare_memory_operand):
        Compare dependence info.

Index: gcc/ipa-icf-gimple.c
===================================================================
--- gcc/ipa-icf-gimple.c        (revision 221174)
+++ gcc/ipa-icf-gimple.c        (working copy)
@@ -305,6 +305,23 @@ func_checker::compare_memory_operand (tr
       get_object_alignment_1 (b2, &align2, &tem);
       if (align1 != align2)
        return return_false_with_msg ("different access alignment");
+
+      /* Similarly we have to compare dependence info where equality
+         tells us we are safe (even some unequal values would be safe
+        but then we have to maintain a map of bases and cliques).  */
+      unsigned short clique1 = 0, base1 = 0, clique2 = 0, base2 = 0;
+      if (TREE_CODE (b1) == MEM_REF)
+       {
+         clique1 = MR_DEPENDENCE_CLIQUE (b1);
+         base1 = MR_DEPENDENCE_BASE (b1);
+       }
+      if (TREE_CODE (b2) == MEM_REF)
+       {
+         clique2 = MR_DEPENDENCE_CLIQUE (b2);
+         base2 = MR_DEPENDENCE_BASE (b2);
+       }
+      if (clique1 != clique2 || base1 != base2)
+       return return_false_with_msg ("different dependence info");
     }
 
   return compare_operand (t1, t2);

2015-03-04  Richard Biener  <rguent...@suse.de>

        PR ipa/65270
        * ipa-icf.c (sem_function::equals_wpa): Make sure to
        have compatible restrict qualifications on function parameters.

Index: gcc/ipa-icf.c
===================================================================
--- gcc/ipa-icf.c       (revision 221174)
+++ gcc/ipa-icf.c       (working copy)
@@ -405,7 +405,10 @@ sem_function::equals_wpa (sem_item *item
 
       if (!func_checker::compatible_types_p (arg_types[i],
                                             m_compared_func->arg_types[i],
-                                            is_not_leaf, i == 0))
+                                            is_not_leaf, i == 0)
+         || (POINTER_TYPE_P (arg_types[i])
+             && (TYPE_RESTRICT (arg_types[i])
+                 != TYPE_RESTRICT (m_compared_func->arg_types[i]))))
        return return_false_with_msg ("argument type is different");
     }
 

Reply via email to