2017-11-15 Alexandre Oliva <aoliva@redhat.com>
+ * dumpfile.h (TDF_COMPARE_DEBUG): New.
+ * final.c (rest_of_clean_state): Set it for the
+ -fcompare-debug dump.
+ * tree-pretty-print.c (dump_generic_node): Omit OBJ_TYPE_REF
+ class when TDF_COMPARE_DEBUG is set.
+
* dwarf2out.c (gen_producer_string): Discard
OPT_fcompare_debug.
#define MSG_NOTE (1 << 24) /* general optimization info */
#define MSG_ALL (MSG_OPTIMIZED_LOCATIONS | MSG_MISSED_OPTIMIZATION \
| MSG_NOTE)
+#define TDF_COMPARE_DEBUG (1 << 25) /* Dumping for -fcompare-debug. */
/* Value of TDF_NONE is used just for bits filtered by TDF_KIND_MASK. */
{
flag_dump_noaddr = flag_dump_unnumbered = 1;
if (flag_compare_debug_opt || flag_compare_debug)
- dump_flags |= TDF_NOUID;
+ dump_flags |= TDF_NOUID | TDF_COMPARE_DEBUG;
dump_function_header (final_output, current_function_decl,
dump_flags);
final_insns_dump_p = true;
pp_string (pp, "OBJ_TYPE_REF(");
dump_generic_node (pp, OBJ_TYPE_REF_EXPR (node), spc, flags, false);
pp_semicolon (pp);
- if (!(flags & TDF_SLIM) && virtual_method_call_p (node))
+ /* We omit the class type for -fcompare-debug because we may
+ drop TYPE_BINFO early depending on debug info, and then
+ virtual_method_call_p would return false, whereas when
+ TYPE_BINFO is preserved it may still return true and then
+ we'd print the class type. Compare tree and rtl dumps for
+ libstdc++-prettyprinters/shared_ptr.cc with and without -g,
+ for example, at occurrences of OBJ_TYPE_REF. */
+ if (!(flags & (TDF_SLIM | TDF_COMPARE_DEBUG))
+ && virtual_method_call_p (node))
{
pp_string (pp, "(");
dump_generic_node (pp, obj_type_ref_class (node), spc, flags, false);