Commit 4a4412b9 by David Malcolm Committed by David Malcolm

Add "-fsave-optimization-record"

This patch implements a -fsave-optimization-record option, which
leads to a JSON file being written out, recording the dump_* calls
made (via the optinfo infrastructure).

The patch includes a minimal version of the JSON patch I posted last
year, with just enough support needed for optimization records (I
removed all of the parser code, leaving just the code for building
in-memory JSON trees and writing them to a pretty_printer).

gcc/ChangeLog:
	* Makefile.in (OBJS): Add json.o and optinfo-emit-json.o.
	(CFLAGS-optinfo-emit-json.o): Define TARGET_NAME.
	* common.opt (fsave-optimization-record): New option.
	* coretypes.h (struct kv_pair): Move here from dumpfile.c.
	* doc/invoke.texi (-fsave-optimization-record): New option.
	* dumpfile.c: Include "optinfo-emit-json.h".
	(struct kv_pair): Move to coretypes.h.
	(optgroup_options): Make non-static.
	(dump_context::end_scope): Call
	optimization_records_maybe_pop_dump_scope.
	* dumpfile.h (optgroup_options): New decl.
	* json.cc: New file.
	* json.h: New file.
	* optinfo-emit-json.cc: New file.
	* optinfo-emit-json.h: New file.
	* optinfo.cc: Include "optinfo-emit-json.h".
	(optinfo::emit): Call optimization_records_maybe_record_optinfo.
	(optinfo_enabled_p): Check optimization_records_enabled_p.
	(optinfo_wants_inlining_info_p): Likewise.
	* optinfo.h: Update comment.
	* profile-count.c (profile_quality_as_string): New function.
	* profile-count.h (profile_quality_as_string): New decl.
	(profile_count::quality): New accessor.
	* selftest-run-tests.c (selftest::run_tests): Call json_cc_tests
	and optinfo_emit_json_cc_tests.
	* selftest.h (selftest::json_cc_tests): New decl.
	(selftest::optinfo_emit_json_cc_tests): New decl.
	* toplev.c: Include "optinfo-emit-json.h".
	(compile_file): Call optimization_records_finish.
	(do_compile): Call optimization_records_start.
	* tree-ssa-live.c: Include optinfo.h.
	(remove_unused_scope_block_p): Retain inlining information if
	optinfo_wants_inlining_info_p returns true.

From-SVN: r262905
parent bf0086f1
2018-07-20 David Malcolm <dmalcolm@redhat.com>
* Makefile.in (OBJS): Add json.o and optinfo-emit-json.o.
(CFLAGS-optinfo-emit-json.o): Define TARGET_NAME.
* common.opt (fsave-optimization-record): New option.
* coretypes.h (struct kv_pair): Move here from dumpfile.c.
* doc/invoke.texi (-fsave-optimization-record): New option.
* dumpfile.c: Include "optinfo-emit-json.h".
(struct kv_pair): Move to coretypes.h.
(optgroup_options): Make non-static.
(dump_context::end_scope): Call
optimization_records_maybe_pop_dump_scope.
* dumpfile.h (optgroup_options): New decl.
* json.cc: New file.
* json.h: New file.
* optinfo-emit-json.cc: New file.
* optinfo-emit-json.h: New file.
* optinfo.cc: Include "optinfo-emit-json.h".
(optinfo::emit): Call optimization_records_maybe_record_optinfo.
(optinfo_enabled_p): Check optimization_records_enabled_p.
(optinfo_wants_inlining_info_p): Likewise.
* optinfo.h: Update comment.
* profile-count.c (profile_quality_as_string): New function.
* profile-count.h (profile_quality_as_string): New decl.
(profile_count::quality): New accessor.
* selftest-run-tests.c (selftest::run_tests): Call json_cc_tests
and optinfo_emit_json_cc_tests.
* selftest.h (selftest::json_cc_tests): New decl.
(selftest::optinfo_emit_json_cc_tests): New decl.
* toplev.c: Include "optinfo-emit-json.h".
(compile_file): Call optimization_records_finish.
(do_compile): Call optimization_records_start.
* tree-ssa-live.c: Include optinfo.h.
(remove_unused_scope_block_p): Retain inlining information if
optinfo_wants_inlining_info_p returns true.
2018-07-20 Richard Biener <rguenther@suse.de>
PR debug/86585
......
......@@ -1387,6 +1387,7 @@ OBJS = \
ira-color.o \
ira-emit.o \
ira-lives.o \
json.o \
jump.o \
langhooks.o \
lcm.o \
......@@ -1428,6 +1429,7 @@ OBJS = \
optabs-query.o \
optabs-tree.o \
optinfo.o \
optinfo-emit-json.o \
options-save.o \
opts-global.o \
passes.o \
......@@ -2251,6 +2253,7 @@ s-bversion: BASE-VER
$(STAMP) s-bversion
CFLAGS-toplev.o += -DTARGET_NAME=\"$(target_noncanonical)\"
CFLAGS-optinfo-emit-json.o += -DTARGET_NAME=\"$(target_noncanonical)\"
pass-instances.def: $(srcdir)/passes.def $(PASSES_EXTRA) \
$(srcdir)/gen-pass-instances.awk
......
......@@ -1955,6 +1955,10 @@ fopt-info-
Common Joined RejectNegative Var(common_deferred_options) Defer
-fopt-info[-<type>=filename] Dump compiler optimization details.
fsave-optimization-record
Common Report Var(flag_save_optimization_record) Optimization
Write a SRCFILE.opt-record.json file detailing what optimizations were performed.
foptimize-register-move
Common Ignore
Does nothing. Preserved for backward compatibility.
......
......@@ -332,6 +332,14 @@ namespace gcc {
typedef std::pair <tree, tree> tree_pair;
/* Define a name->value mapping. */
template <typename ValueType>
struct kv_pair
{
const char *const name; /* the name of the value */
const ValueType value; /* the value of the name */
};
#else
struct _dont_use_rtx_here_;
......
......@@ -419,7 +419,8 @@ Objective-C and Objective-C++ Dialects}.
-freorder-blocks-algorithm=@var{algorithm} @gol
-freorder-blocks-and-partition -freorder-functions @gol
-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
-frounding-math -fsave-optimization-record @gol
-fsched2-use-superblocks -fsched-pressure @gol
-fsched-spec-load -fsched-spec-load-dangerous @gol
-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
-fsched-group-heuristic -fsched-critical-path-heuristic @gol
......@@ -13969,6 +13970,51 @@ the first option takes effect and the subsequent options are
ignored. Thus only @file{vec.miss} is produced which contains
dumps from the vectorizer about missed opportunities.
@item -fsave-optimization-record
@opindex fsave-optimization-record
Write a SRCFILE.opt-record.json file detailing what optimizations
were performed, for those optimizations that support @option{-fopt-info}.
This option is experimental and the format of the data within the JSON
file is subject to change.
It is roughly equivalent to a machine-readable version of
@option{-fopt-info-all}, as a collection of messages with source file,
line number and column number, with the following additional data for
each message:
@itemize @bullet
@item
the execution count of the code being optimized, along with metadata about
whether this was from actual profile data, or just an estimate, allowing
consumers to prioritize messages by code hotness,
@item
the function name of the code being optimized, where applicable,
@item
the ``inlining chain'' for the code being optimized, so that when
a function is inlined into several different places (which might
themselves be inlined), the reader can distinguish between the copies,
@item
objects identifying those parts of the message that refer to expressions,
statements or symbol-table nodes, which of these categories they are, and,
when available, their source code location,
@item
the GCC pass that emitted the message, and
@item
the location in GCC's own code from which the message was emitted
@end itemize
Additionally, some messages are logically nested within other
messages, reflecting implementation details of the optimization
passes.
@item -fsched-verbose=@var{n}
@opindex fsched-verbose
On targets that use instruction scheduling, this option controls the
......@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "dump-context.h"
#include "cgraph.h"
#include "tree-pass.h" /* for "current_pass". */
#include "optinfo-emit-json.h"
/* If non-NULL, return one past-the-end of the matching SUBPART of
the WHOLE string. */
......@@ -118,14 +119,6 @@ static struct dump_file_info dump_files[TDI_end] =
DUMP_FILE_INFO (NULL, "ipa-all", DK_ipa, 0),
};
/* Define a name->number mapping for a dump flag value. */
template <typename ValueType>
struct kv_pair
{
const char *const name; /* the name of the value */
const ValueType value; /* the value of the name */
};
/* Table of dump options. This must be consistent with the TDF_* flags
in dumpfile.h and opt_info_options below. */
static const kv_pair<dump_flags_t> dump_options[] =
......@@ -176,7 +169,7 @@ static const kv_pair<dump_flags_t> optinfo_verbosity_options[] =
};
/* Flags used for -fopt-info groups. */
static const kv_pair<optgroup_flags_t> optgroup_options[] =
const kv_pair<optgroup_flags_t> optgroup_options[] =
{
{"ipa", OPTGROUP_IPA},
{"loop", OPTGROUP_LOOP},
......@@ -801,6 +794,7 @@ dump_context::end_scope ()
{
end_any_optinfo ();
m_scope_depth--;
optimization_records_maybe_pop_dump_scope ();
}
/* Return the optinfo currently being accumulated, creating one if
......@@ -827,8 +821,7 @@ dump_context::begin_next_optinfo (const dump_location_t &loc)
}
/* End any optinfo that has been accumulated within this context; emitting
it to any destinations as appropriate - though none have currently been
implemented. */
it to any destinations as appropriate, such as optimization records. */
void
dump_context::end_any_optinfo ()
......
......@@ -420,6 +420,7 @@ extern FILE *dump_begin (int, dump_flags_t *, int part=-1);
extern void dump_end (int, FILE *);
extern int opt_info_switch_p (const char *);
extern const char *dump_flag_name (int);
extern const kv_pair<optgroup_flags_t> optgroup_options[];
/* Global variables used to communicate with passes. */
extern FILE *dump_file;
......@@ -442,6 +443,7 @@ dump_enabled_p (void)
(a) the active dump_file, if any
(b) the -fopt-info destination, if any
(c) to the "optinfo" destinations, if any:
(c.1) as optimization records
dump_* (MSG_*) --> dumpfile.c --+--> (a) dump_file
|
......@@ -449,6 +451,7 @@ dump_enabled_p (void)
|
`--> (c) optinfo
`---> optinfo destinations
(c.1) optimization records
For optinfos, the dump_*_loc mark the beginning of an optinfo
instance: all subsequent dump_* calls are consolidated into
......
/* JSON trees
Copyright (C) 2017-2018 Free Software Foundation, Inc.
Contributed by David Malcolm <dmalcolm@redhat.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "json.h"
#include "pretty-print.h"
#include "math.h"
#include "selftest.h"
using namespace json;
/* class json::value. */
/* Dump this json::value tree to OUTF.
No formatting is done. There are no guarantees about the order
in which the key/value pairs of json::objects are printed. */
void
value::dump (FILE *outf) const
{
pretty_printer pp;
pp_buffer (&pp)->stream = outf;
print (&pp);
pp_flush (&pp);
}
/* class json::object, a subclass of json::value, representing
an unordered collection of key/value pairs. */
/* json:object's dtor. */
object::~object ()
{
for (map_t::iterator it = m_map.begin (); it != m_map.end (); ++it)
{
free (const_cast <char *>((*it).first));
delete ((*it).second);
}
}
/* Implementation of json::value::print for json::object. */
void
object::print (pretty_printer *pp) const
{
/* Note that the order is not guaranteed. */
pp_character (pp, '{');
for (map_t::iterator it = m_map.begin (); it != m_map.end (); ++it)
{
if (it != m_map.begin ())
pp_string (pp, ", ");
const char *key = const_cast <char *>((*it).first);
value *value = (*it).second;
pp_printf (pp, "\"%s\": ", key); // FIXME: escaping?
value->print (pp);
}
pp_character (pp, '}');
}
/* Set the json::value * for KEY, taking ownership of VALUE
(and taking a copy of KEY if necessary). */
void
object::set (const char *key, value *v)
{
value **ptr = m_map.get (key);
if (ptr)
{
/* If the key is already present, delete the existing value
and overwrite it. */
delete *ptr;
*ptr = v;
}
else
/* If the key wasn't already present, take a copy of the key,
and store the value. */
m_map.put (xstrdup (key), v);
}
/* class json::array, a subclass of json::value, representing
an ordered collection of values. */
/* json::array's dtor. */
array::~array ()
{
unsigned i;
value *v;
FOR_EACH_VEC_ELT (m_elements, i, v)
delete v;
}
/* Implementation of json::value::print for json::array. */
void
array::print (pretty_printer *pp) const
{
pp_character (pp, '[');
unsigned i;
value *v;
FOR_EACH_VEC_ELT (m_elements, i, v)
{
if (i)
pp_string (pp, ", ");
v->print (pp);
}
pp_character (pp, ']');
}
/* class json::number, a subclass of json::value, wrapping a double. */
/* Implementation of json::value::print for json::number. */
void
number::print (pretty_printer *pp) const
{
char tmp[1024];
snprintf (tmp, sizeof (tmp), "%g", m_value);
pp_string (pp, tmp);
}
/* class json::string, a subclass of json::value. */
void
string::print (pretty_printer *pp) const
{
pp_character (pp, '"');
for (const char *ptr = m_utf8; *ptr; ptr++)
{
char ch = *ptr;
switch (ch)
{
case '"':
pp_string (pp, "\\\"");
break;
case '\\':
pp_string (pp, "\\n");
break;
case '\b':
pp_string (pp, "\\b");
break;
case '\f':
pp_string (pp, "\\f");
break;
case '\n':
pp_string (pp, "\\n");
break;
case '\r':
pp_string (pp, "\\r");
break;
case '\t':
pp_string (pp, "\\t");
break;
default:
pp_character (pp, ch);
}
}
pp_character (pp, '"');
}
/* class json::literal, a subclass of json::value. */
/* Implementation of json::value::print for json::literal. */
void
literal::print (pretty_printer *pp) const
{
switch (m_kind)
{
case JSON_TRUE:
pp_string (pp, "true");
break;
case JSON_FALSE:
pp_string (pp, "false");
break;
case JSON_NULL:
pp_string (pp, "null");
break;
default:
gcc_unreachable ();
}
}
#if CHECKING_P
namespace selftest {
/* Selftests. */
/* Verify that JV->print () prints EXPECTED_JSON. */
static void
assert_print_eq (const json::value &jv, const char *expected_json)
{
pretty_printer pp;
jv.print (&pp);
ASSERT_STREQ (expected_json, pp_formatted_text (&pp));
}
/* Verify that JSON objects are written correctly. We can't test more than
one key/value pair, as we don't impose a guaranteed ordering. */
static void
test_writing_objects ()
{
object obj;
obj.set ("foo", new json::string ("bar"));
assert_print_eq (obj, "{\"foo\": \"bar\"}");
}
/* Verify that JSON arrays are written correctly. */
static void
test_writing_arrays ()
{
array arr;
assert_print_eq (arr, "[]");
arr.append (new json::string ("foo"));
assert_print_eq (arr, "[\"foo\"]");
arr.append (new json::string ("bar"));
assert_print_eq (arr, "[\"foo\", \"bar\"]");
}
/* Verify that JSON numbers are written correctly. */
static void
test_writing_numbers ()
{
assert_print_eq (number (0), "0");
assert_print_eq (number (42), "42");
assert_print_eq (number (-100), "-100");
}
/* Verify that JSON strings are written correctly. */
static void
test_writing_strings ()
{
string foo ("foo");
assert_print_eq (foo, "\"foo\"");
string contains_quotes ("before \"quoted\" after");
assert_print_eq (contains_quotes, "\"before \\\"quoted\\\" after\"");
}
/* Verify that JSON strings are written correctly. */
static void
test_writing_literals ()
{
assert_print_eq (literal (JSON_TRUE), "true");
assert_print_eq (literal (JSON_FALSE), "false");
assert_print_eq (literal (JSON_NULL), "null");
}
/* Run all of the selftests within this file. */
void
json_cc_tests ()
{
test_writing_objects ();
test_writing_arrays ();
test_writing_numbers ();
test_writing_strings ();
test_writing_literals ();
}
} // namespace selftest
#endif /* #if CHECKING_P */
/* JSON trees
Copyright (C) 2017-2018 Free Software Foundation, Inc.
Contributed by David Malcolm <dmalcolm@redhat.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_JSON_H
#define GCC_JSON_H
/* Implementation of JSON, a lightweight data-interchange format.
See http://www.json.org/
and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
and https://tools.ietf.org/html/rfc7159
Supports creating a DOM-like tree of json::value *, and then dumping
json::value * to text. */
namespace json
{
/* Forward decls of json::value and its subclasses (using indentation
to denote inheritance. */
class value;
class object;
class array;
class number;
class string;
class literal;
/* An enum for discriminating the subclasses of json::value. */
enum kind
{
/* class json::object. */
JSON_OBJECT,
/* class json::array. */
JSON_ARRAY,
/* class json::number. */
JSON_NUMBER,
/* class json::string. */
JSON_STRING,
/* class json::literal uses these three values to identify the
particular literal. */
JSON_TRUE,
JSON_FALSE,
JSON_NULL
};
/* Base class of JSON value. */
class value
{
public:
virtual ~value () {}
virtual enum kind get_kind () const = 0;
virtual void print (pretty_printer *pp) const = 0;
void dump (FILE *) const;
};
/* Subclass of value for objects: an unordered collection of
key/value pairs. */
class object : public value
{
public:
~object ();
enum kind get_kind () const FINAL OVERRIDE { return JSON_OBJECT; }
void print (pretty_printer *pp) const FINAL OVERRIDE;
void set (const char *key, value *v);
private:
typedef hash_map <char *, value *,
simple_hashmap_traits<nofree_string_hash, value *> > map_t;
map_t m_map;
};
/* Subclass of value for arrays. */
class array : public value
{
public:
~array ();
enum kind get_kind () const FINAL OVERRIDE { return JSON_ARRAY; }
void print (pretty_printer *pp) const FINAL OVERRIDE;
void append (value *v) { m_elements.safe_push (v); }
private:
auto_vec<value *> m_elements;
};
/* Subclass of value for numbers. */
class number : public value
{
public:
number (double value) : m_value (value) {}
enum kind get_kind () const FINAL OVERRIDE { return JSON_NUMBER; }
void print (pretty_printer *pp) const FINAL OVERRIDE;
double get () const { return m_value; }
private:
double m_value;
};
/* Subclass of value for strings. */
class string : public value
{
public:
string (const char *utf8) : m_utf8 (xstrdup (utf8)) {}
~string () { free (m_utf8); }
enum kind get_kind () const FINAL OVERRIDE { return JSON_STRING; }
void print (pretty_printer *pp) const FINAL OVERRIDE;
const char *get_string () const { return m_utf8; }
private:
char *m_utf8;
};
/* Subclass of value for the three JSON literals "true", "false",
and "null". */
class literal : public value
{
public:
literal (enum kind kind) : m_kind (kind) {}
enum kind get_kind () const FINAL OVERRIDE { return m_kind; }
void print (pretty_printer *pp) const FINAL OVERRIDE;
private:
enum kind m_kind;
};
} // namespace json
#endif /* GCC_JSON_H */
/* Emit optimization information as JSON files.
Copyright (C) 2018 Free Software Foundation, Inc.
Contributed by David Malcolm <dmalcolm@redhat.com>.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef GCC_OPTINFO_EMIT_JSON_H
#define GCC_OPTINFO_EMIT_JSON_H
class optinfo;
struct opt_pass;
extern void optimization_records_start ();
extern void optimization_records_finish ();
extern bool optimization_records_enabled_p ();
extern void optimization_records_maybe_record_optinfo (const optinfo *);
extern void optimization_records_maybe_pop_dump_scope ();
#endif /* #ifndef GCC_OPTINFO_EMIT_JSON_H */
......@@ -27,6 +27,7 @@ along with GCC; see the file COPYING3. If not see
#include "gimple.h"
#include "optinfo.h"
#include "optinfo-emit-json.h"
#include "dump-context.h"
#include "pretty-print.h"
#include "gimple-pretty-print.h"
......@@ -85,7 +86,8 @@ optinfo::~optinfo ()
void
optinfo::emit ()
{
/* currently this is a no-op. */
/* -fsave-optimization-record. */
optimization_records_maybe_record_optinfo (this);
}
/* Update the optinfo's kind based on DUMP_KIND. */
......@@ -221,9 +223,8 @@ optinfo::add_dec (const wide_int_ref &wi, signop sgn)
bool optinfo_enabled_p ()
{
/* Currently no destinations are implemented, just a hook for
selftests. */
return dump_context::get ().forcibly_enable_optinfo_p ();
return (dump_context::get ().forcibly_enable_optinfo_p ()
|| optimization_records_enabled_p ());
}
/* Return true if any of the active optinfo destinations make use
......@@ -232,5 +233,5 @@ bool optinfo_enabled_p ()
bool optinfo_wants_inlining_info_p ()
{
return false;
return optimization_records_enabled_p ();
}
......@@ -25,12 +25,8 @@ along with GCC; see the file COPYING3. If not see
optimization, which can be emitted to zero or more of several
destinations, such as:
* as a "remark" through the diagnostics subsystem
* saved to a file as an "optimization record"
Currently no such destinations are implemented.
They are generated in response to calls to the "dump_*" API in
dumpfile.h; repeated calls to the "dump_*" API are consolidated
into a pending optinfo instance, with a "dump_*_loc" starting a new
......
......@@ -33,6 +33,34 @@ along with GCC; see the file COPYING3. If not see
#include "wide-int.h"
#include "sreal.h"
/* Get a string describing QUALITY. */
const char *
profile_quality_as_string (enum profile_quality quality)
{
switch (quality)
{
default:
gcc_unreachable ();
case profile_uninitialized:
return "uninitialized";
case profile_guessed_local:
return "guessed_local";
case profile_guessed_global0:
return "guessed_global0";
case profile_guessed_global0adjusted:
return "guessed_global0adjusted";
case profile_guessed:
return "guessed";
case profile_afdo:
return "afdo";
case profile_adjusted:
return "adjusted";
case profile_precise:
return "precise";
}
}
/* Dump THIS to F. */
void
......
......@@ -59,6 +59,8 @@ enum profile_quality {
profile_precise
};
extern const char *profile_quality_as_string (enum profile_quality);
/* The base value for branch probability notes and edge probabilities. */
#define REG_BR_PROB_BASE 10000
......@@ -721,6 +723,9 @@ public:
return m_quality == profile_precise;
}
/* Get the quality of the count. */
enum profile_quality quality () const { return m_quality; }
/* When merging basic blocks, the two different profile counts are unified.
Return true if this can be done without losing info about profile.
The only case we care about here is when first BB contains something
......
......@@ -72,6 +72,8 @@ selftest::run_tests ()
typed_splay_tree_c_tests ();
unique_ptr_tests_cc_tests ();
opt_proposer_c_tests ();
json_cc_tests ();
optinfo_emit_json_cc_tests ();
/* Mid-level data structures. */
input_c_tests ();
......
......@@ -228,6 +228,8 @@ extern void gimple_c_tests ();
extern void hash_map_tests_c_tests ();
extern void hash_set_tests_c_tests ();
extern void input_c_tests ();
extern void json_cc_tests ();
extern void optinfo_emit_json_cc_tests ();
extern void predict_c_tests ();
extern void pretty_print_c_tests ();
extern void read_rtl_function_c_tests ();
......
......@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-pass.h"
#include "dumpfile.h"
#include "ipa-fnsummary.h"
#include "optinfo-emit-json.h"
#if defined(DBX_DEBUGGING_INFO) || defined(XCOFF_DEBUGGING_INFO)
#include "dbxout.h"
......@@ -487,6 +488,8 @@ compile_file (void)
if (lang_hooks.decls.post_compilation_parsing_cleanups)
lang_hooks.decls.post_compilation_parsing_cleanups ();
optimization_records_finish ();
if (seen_error ())
return;
......@@ -2118,6 +2121,8 @@ do_compile ()
timevar_start (TV_PHASE_SETUP);
optimization_records_start ();
/* This must be run always, because it is needed to compute the FP
predefined macros, such as __LDBL_MAX__, for targets using non
default FP formats. */
......
......@@ -40,6 +40,7 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "stringpool.h"
#include "attribs.h"
#include "optinfo.h"
static void verify_live_on_entry (tree_live_info_p);
......@@ -552,7 +553,8 @@ remove_unused_scope_block_p (tree scope, bool in_ctor_dtor_block)
;
/* When not generating debug info we can eliminate info on unused
variables. */
else if (!flag_auto_profile && debug_info_level == DINFO_LEVEL_NONE)
else if (!flag_auto_profile && debug_info_level == DINFO_LEVEL_NONE
&& !optinfo_wants_inlining_info_p ())
{
/* Even for -g0 don't prune outer scopes from artificial
functions, otherwise diagnostics using tree_nonartificial_location
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment