Hash ODR name for OBJ_TYPE_REF
Wed Nov 18 07:30:34 GMT 2020
main purpose of obj_type_ref is to hold the type that was used in
virutal call. We do not hash this info in hash_operand that causes a
lot of miscompares at ICF time. With LTO this is quite important for
icf performance and in that case we do have manged type names (for
Building libxul without patch we get 1477890 miscompares at:
libxul.so.wpa.076i.icf: false returned: 'operand_equal_p failed' in compare_operand at ../../gcc/ipa-icf-gimple.c:356
With patch this turns into 242454.
Bootstrapped/regtested x86_64-linux, OK?
* fold-const.c (operand_compare::hash_operand): Hash ODR name of
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index ddf18f27cb7..e759ddb1e60 100644
@@ -3866,6 +3866,16 @@ operand_compare::hash_operand (const_tree t, inchash::hash &hstate,
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);
+ if (tree c = obj_type_ref_class (t))
+ c = TYPE_NAME (TYPE_MAIN_VARIANT (c));
+ /* We compute mangled names only when free_lang_data is run.
+ In that case we can hash precisely. */
+ if (DECL_ASSEMBLER_NAME_SET_P (c))
+ (DECL_ASSEMBLER_NAME (c)));
More information about the Gcc-patches