gcc/ChangeLog:
2019-07-24 Martin Liska
* ipa-icf-gimple.c (func_checker::compare_ssa_name): Call
compare_operand.
(func_checker::compare_memory_operand): Remove.
(func_checker::compare_cst_or_decl): Remove.
(func_checker::operand_equal_valueize): Do not handle
FIELD_DECL.
(func_checker::compare_gimple_call): Call compare_operand.
(func_checker::compare_gimple_assign): Likewise.
* ipa-icf-gimple.h: Remove compare_cst_or_decl.
* ipa-icf.c (sem_function::icf_handled_component_p): Remove.
* ipa-icf.h (icf_handled_component_p): Remove.
---
gcc/ipa-icf-gimple.c | 150 ++-
gcc/ipa-icf-gimple.h | 4 --
gcc/ipa-icf.c| 11
gcc/ipa-icf.h| 3 -
4 files changed, 6 insertions(+), 162 deletions(-)
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 8448d387428..2d4c5d22534 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -111,13 +111,7 @@ func_checker::compare_ssa_name (tree t1, tree t2)
tree b1 = SSA_NAME_VAR (t1);
tree b2 = SSA_NAME_VAR (t2);
- if (b1 == NULL && b2 == NULL)
- return true;
-
- if (b1 == NULL || b2 == NULL || TREE_CODE (b1) != TREE_CODE (b2))
- return return_false ();
-
- return compare_cst_or_decl (b1, b2);
+ return compare_operand (b1, b2);
}
return true;
@@ -247,86 +241,12 @@ func_checker::compatible_types_p (tree t1, tree t2)
return true;
}
-/* Function compare for equality given memory operands T1 and T2. */
-
-bool
-func_checker::compare_memory_operand (tree t1, tree t2)
-{
- if (!t1 && !t2)
-return true;
- else if (!t1 || !t2)
-return false;
-
- ao_ref r1, r2;
- ao_ref_init (, t1);
- ao_ref_init (, t2);
-
- tree b1 = ao_ref_base ();
- tree b2 = ao_ref_base ();
-
- bool source_is_memop = DECL_P (b1) || INDIRECT_REF_P (b1)
- || TREE_CODE (b1) == MEM_REF
- || TREE_CODE (b1) == TARGET_MEM_REF;
-
- bool target_is_memop = DECL_P (b2) || INDIRECT_REF_P (b2)
- || TREE_CODE (b2) == MEM_REF
- || TREE_CODE (b2) == TARGET_MEM_REF;
-
- /* Compare alias sets for memory operands. */
- if (source_is_memop && target_is_memop)
-{
- if (TREE_THIS_VOLATILE (t1) != TREE_THIS_VOLATILE (t2))
- return return_false_with_msg ("different operand volatility");
-
- if (ao_ref_alias_set () != ao_ref_alias_set ()
- || ao_ref_base_alias_set () != ao_ref_base_alias_set ())
- return return_false_with_msg ("ao alias sets are different");
-
- /* We can't simply use get_object_alignment_1 on the full
- reference as for accesses with variable indexes this reports
- too conservative alignment. We also can't use the ao_ref_base
- base objects as ao_ref_base happily strips MEM_REFs around
- decls even though that may carry alignment info. */
- b1 = t1;
- while (handled_component_p (b1))
- b1 = TREE_OPERAND (b1, 0);
- b2 = t2;
- while (handled_component_p (b2))
- b2 = TREE_OPERAND (b2, 0);
- unsigned int align1, align2;
- unsigned HOST_WIDE_INT tem;
- get_object_alignment_1 (b1, , );
- get_object_alignment_1 (b2, , );
- 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);
-}
-
/* Function compare for equality given trees T1 and T2 which
can be either a constant or a declaration type. */
bool
-func_checker::hash_operand_valueize (const_tree arg, inchash::hash ,
- unsigned int flags)
+func_checker::hash_operand_valueize (const_tree arg, inchash::hash &,
+ unsigned int)
{
switch (TREE_CODE (arg))
{
@@ -346,52 +266,6 @@ func_checker::hash_operand_valueize (const_tree arg, inchash::hash ,
return false;
}
-bool
-func_checker::compare_cst_or_decl (tree t1, tree t2)
-{
- bool ret;
-
- switch (TREE_CODE (t1))
-{
-case INTEGER_CST:
-case COMPLEX_CST:
-case VECTOR_CST:
-case STRING_CST:
-case REAL_CST:
- {
- ret = compatible_types_p (TREE_TYPE (t1), TREE_TYPE (t2))
- && operand_equal_p (t1, t2, OEP_ONLY_CONST);
- return return_with_debug (ret);
- }
-case FUNCTION_DECL:
- /* All function decls are in the symbol table and known to match
- before we start comparing bodies. */
- return true;
-case VAR_DECL: