This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[google/4_8] Disable -g/-gmlt during LIPO instrumentation
- From: Teresa Johnson <tejohnson at google dot com>
- To: David Li <davidxl at google dot com>, Rong Xu <xur at google dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 27 Sep 2013 11:50:30 -0700
- Subject: [google/4_8] Disable -g/-gmlt during LIPO instrumentation
- Authentication-results: sourceware.org; auth=none
David and Rong,
The following patch will disable -g/-gmlt when instrumenting for LIPO
since they will affect the recorded ggc_memory used in the module
grouping decision. Added -fripa-allow-debug to override this behavior.
Passes regression tests and simple tests on the new functionality.
Ok for google/4_8?
Teresa
2013-09-27 Teresa Johnson <tejohnson@google.com>
* opts.c (finish_options): Suppress -g/-gmlt when we are
building for LIPO instrumention.
* common.opt (fripa-allow-debug): New option.
Index: opts.c
===================================================================
--- opts.c (revision 202976)
+++ opts.c (working copy)
@@ -799,7 +799,7 @@ finish_options (struct gcc_options *opts, struct g
#endif
if (!opts->x_flag_fat_lto_objects && !HAVE_LTO_PLUGIN)
error_at (loc, "-fno-fat-lto-objects are supported only with
linker plugin.");
-}
+ }
if ((opts->x_flag_lto_partition_balanced != 0) +
(opts->x_flag_lto_partition_1to1 != 0)
+ (opts->x_flag_lto_partition_none != 0) >= 1)
{
@@ -852,6 +852,26 @@ finish_options (struct gcc_options *opts, struct g
/* Turn on -ffunction-sections when -freorder-functions=* is used. */
if (opts->x_flag_reorder_functions > 1)
opts->x_flag_function_sections = 1;
+
+ /* LIPO module grouping depends on the memory consumed by the profile-gen
+ parsing phase, recorded in a per-module ggc_memory field of the module
+ info struct. This will be higher when debug generation is on via
+ -g/-gmlt, which causes the FE to generate debug structures that will
+ increase the ggc_total_memory. This could in theory cause the module
+ groups to be slightly more conservative. Disable -g/-gmlt under
+ -fripa -fprofile-generate, but provide an option to override this
+ in case we actually need to debug an instrumented binary. */
+ if (opts->x_profile_arc_flag
+ && opts->x_flag_dyn_ipa
+ && opts->x_debug_info_level != DINFO_LEVEL_NONE
+ && !opts->x_flag_dyn_ipa_allow_debug)
+ {
+ inform (loc,
+ "Debug generation via -g option disabled under -fripa "
+ "-fprofile-generate (use -fripa-allow-debug to override)");
+ set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, "0", opts, opts_set,
+ loc);
+ }
}
#define LEFT_COLUMN 27
Index: common.opt
===================================================================
--- common.opt (revision 202976)
+++ common.opt (working copy)
@@ -1155,6 +1155,10 @@ fripa
Common Report Var(flag_dyn_ipa)
Perform Dynamic Inter-Procedural Analysis.
+fripa-allow-debug
+Common Report Var(flag_dyn_ipa_allow_debug) Init(0)
+Allow -g enablement for -fripa -fprofile-generate compiles.
+
fripa-disallow-asm-modules
Common Report Var(flag_ripa_disallow_asm_modules)
Don't import an auxiliary module if it contains asm statements
--
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413