introduce TDF_compare_debug, omit OBJ_TYPE_REF casts with it

for  gcc/ChangeLog

	* 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.

From-SVN: r254751
This commit is contained in:
Alexandre Oliva 2017-11-15 03:11:48 +00:00 committed by Alexandre Oliva
parent 3267bd36aa
commit 171a55e7f5
4 changed files with 17 additions and 2 deletions

View File

@ -1,5 +1,11 @@
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.

View File

@ -93,6 +93,7 @@ enum dump_kind
#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. */

View File

@ -4629,7 +4629,7 @@ rest_of_clean_state (void)
{
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;

View File

@ -2760,7 +2760,15 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
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);