From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66361 invoked by alias); 25 Jan 2020 22:36:39 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 66352 invoked by uid 89); 25 Jan 2020 22:36:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy= X-Spam-Status: No, score=-25.2 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx2.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Wed, 01 Jan 2020 00:00:00 -0000 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com Subject: [committed] Add --import-optimize/--no-import-optimize Message-ID: <20200125223631.GA18433@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2020-q1/txt/msg00055.txt Hi, The function create_import_tree attempts to reduce the number of DW_TAG_imported_unit DIEs. Add command line options --import-optimize/--no-opt-importize to control this optimization. Committed to trunk. Thanks, - Tom Add --import-optimize/--no-import-optimize 2020-01-24 Tom de Vries * dwz.1: Add --import-optimize/--no-import-optimize entry. * dwz.c (import_opt_p): New variable. (create_import_tree): Move freeing of seen variable to ASAP instead of ALAP. Guard optimization part with import_opt_p. (dwz_options, dwz_common_options_help): Add --import-optimize/--no-import-optimize. --- dwz.1 | 8 ++++++++ dwz.c | 17 +++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/dwz.1 b/dwz.1 index 3df7e59..b48bc02 100644 --- a/dwz.1 +++ b/dwz.1 @@ -105,6 +105,14 @@ In normal operation, the link setting should be used. The basic setting is provided only as fallback in case of problems with the link setting. Set to link by default. .TP +.B \-\-import-optimize / \-\-no-import-optimize +Enable/disable optimization that reduces the number of +\fIDW_TAG_imported_unit\fR DIEs generated to import the partial units created +by \fBdwz\fR. Disabling the optimization can be used to work around problems +in the optimization, or to make it easier to observe which CU imports which +PU. +Enabled by default. +.TP .B \-? \-\-help Print short help and exit. .TP diff --git a/dwz.c b/dwz.c index a81e42a..bffbaa1 100644 --- a/dwz.c +++ b/dwz.c @@ -210,6 +210,7 @@ static int verify_edges_p = 0; static int dump_edges_p = 0; static int partition_dups_opt; static int progress_p; +static int import_opt_p = 1; enum die_count_methods { none, @@ -7859,6 +7860,8 @@ create_import_tree (void) dump_edges ("phase 1", ipus, npus, ncus); if (unlikely (verify_edges_p)) verify_edges (ipus, npus, ncus, 1); + if (!import_opt_p) + goto opt_done; if (unlikely (progress_p)) { report_progress (); @@ -8371,10 +8374,12 @@ create_import_tree (void) max_seen = 0; } } + free (seen); if (unlikely (dump_edges_p)) dump_edges ("phase 3", ipus, npus, ncus); if (unlikely (verify_edges_p)) verify_edges (ipus, npus, ncus, 3); + opt_done: if (unlikely (progress_p)) { report_progress (); @@ -8457,7 +8462,6 @@ create_import_tree (void) for (cu = alt_first_cu; cu; cu = cu->cu_next) cu->u1.cu_icu = NULL; obstack_free (&ob2, to_free); - free (seen); return 0; } @@ -14451,6 +14455,10 @@ static struct option dwz_options[] = { "multifile-name", required_argument, 0, 'M' }, { "relative", no_argument, 0, 'r' }, { "version", no_argument, 0, 'v' }, + { "import-optimization", + no_argument, &import_opt_p, 1 }, + { "no-import-optimization", + no_argument, &import_opt_p, 0 }, #if DEVEL { "devel-trace", no_argument, &tracing, 1 }, { "devel-progress", no_argument, &progress_p, 1 }, @@ -14502,7 +14510,12 @@ static struct option_help dwz_common_options_help[] = { NULL, "no-odr", NULL, "Enabled", "Enable/disable one definition rule optimization." }, { NULL, "odr-mode", "", "link", - "Set aggressiveness level of one definition rule optimization." } + "Set aggressiveness level of one definition rule optimization." }, + { NULL, "import-optimization", NULL, NULL, + NULL }, + { NULL, "no-import-optimization", NULL, "Enabled", + "Enable/disable optimization that reduces the number of" + " DW_TAG_imported_unit DIEs." } }; /* Describe single-file command line options. */