From: Martin Liska Date: Wed, 30 Oct 2019 11:56:58 +0000 (+0100) Subject: operand_equal_p: add support for OBJ_TYPE_REF. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=96e05bf5aece312bb35736bf3b6bd59560b312a1;p=gcc.git operand_equal_p: add support for OBJ_TYPE_REF. 2019-10-30 Martin Liska * fold-const.c (operand_equal_p): Support OBJ_TYPE_REF. * tree.c (add_expr): Hash parts of OBJ_TYPE_REF. From-SVN: r277612 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 89ddfcef05a..6b32d1ff2bb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-10-30 Martin Liska + + * fold-const.c (operand_equal_p): Support OBJ_TYPE_REF. + * tree.c (add_expr): Hash parts of OBJ_TYPE_REF. + 2019-10-30 Martin Liska PR lto/91393 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 58b967e48fe..8c6e5105ebf 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3325,6 +3325,24 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) flags &= ~OEP_ADDRESS_OF; return OP_SAME (1) && OP_SAME (2); + /* Virtual table call. */ + case OBJ_TYPE_REF: + { + if (!operand_equal_p (OBJ_TYPE_REF_EXPR (arg0), + OBJ_TYPE_REF_EXPR (arg1), flags)) + return false; + if (tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg0)) + != tree_to_uhwi (OBJ_TYPE_REF_TOKEN (arg1))) + return false; + if (!operand_equal_p (OBJ_TYPE_REF_OBJECT (arg0), + OBJ_TYPE_REF_OBJECT (arg1), flags)) + return false; + if (!types_same_for_odr (obj_type_ref_class (arg0), + obj_type_ref_class (arg1))) + return false; + return true; + } + default: return false; } diff --git a/gcc/tree.c b/gcc/tree.c index 23fe5bffd37..75405067ab6 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8027,6 +8027,12 @@ add_expr (const_tree t, inchash::hash &hstate, unsigned int flags) inchash::add_expr (TARGET_EXPR_SLOT (t), hstate, flags); return; + /* Virtual table call. */ + case OBJ_TYPE_REF: + inchash::add_expr (OBJ_TYPE_REF_EXPR (t), hstate, flags); + inchash::add_expr (OBJ_TYPE_REF_TOKEN (t), hstate, flags); + inchash::add_expr (OBJ_TYPE_REF_OBJECT (t), hstate, flags); + return; default: break; }