summaryrefslogtreecommitdiff
path: root/gcc/ipa-icf-gimple.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-01 01:10:32 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-01 01:10:32 +0000
commit2f51f5cbd77a73353de2a8664355bec97318c7c6 (patch)
tree600fa254df54b044fbc358f14a92640ecd60f828 /gcc/ipa-icf-gimple.c
parent1bd06fb43ddd00a91bf007d8d902d715f5c284dc (diff)
downloadgcc-2f51f5cbd77a73353de2a8664355bec97318c7c6.tar.gz
* ipa-icf-gimple.c (func_checker::compare_operand): Fix handling
of OBJ_TYPE_REF. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-icf-gimple.c')
-rw-r--r--gcc/ipa-icf-gimple.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index cbeb7952ca1..18631730b69 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -448,18 +448,23 @@ func_checker::compare_operand (tree t1, tree t2)
/* Virtual table call. */
case OBJ_TYPE_REF:
{
- x1 = TREE_OPERAND (t1, 0);
- x2 = TREE_OPERAND (t2, 0);
- y1 = TREE_OPERAND (t1, 1);
- y2 = TREE_OPERAND (t2, 1);
- z1 = TREE_OPERAND (t1, 2);
- z2 = TREE_OPERAND (t2, 2);
-
- ret = compare_ssa_name (x1, x2)
- && compare_operand (y1, y2)
- && compare_cst_or_decl (z1, z2);
-
- return return_with_debug (ret);
+ if (!compare_ssa_name (OBJ_TYPE_REF_EXPR (t1), OBJ_TYPE_REF_EXPR (t2)))
+ return return_false ();
+ if (opt_for_fn (m_source_func_decl, flag_devirtualize)
+ && virtual_method_call_p (t1))
+ {
+ if (tree_to_uhwi (OBJ_TYPE_REF_TOKEN (t1))
+ != tree_to_uhwi (OBJ_TYPE_REF_TOKEN (t2)))
+ return return_false_with_msg ("OBJ_TYPE_REF token mismatch");
+ if (!types_same_for_odr (obj_type_ref_class (t1),
+ obj_type_ref_class (t2)))
+ return return_false_with_msg ("OBJ_TYPE_REF OTR type mismatch");
+ if (!compare_ssa_name (OBJ_TYPE_REF_OBJECT (t1),
+ OBJ_TYPE_REF_OBJECT (t2)))
+ return return_false_with_msg ("OBJ_TYPE_REF object mismatch");
+ }
+
+ return return_with_debug (true);
}
case IMAGPART_EXPR:
case REALPART_EXPR: