From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55263 invoked by alias); 24 Jul 2018 11:38:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 55241 invoked by uid 89); 24 Jul 2018 11:38:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy=assess X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 24 Jul 2018 11:38:57 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7A0B6AD53; Tue, 24 Jul 2018 11:38:55 +0000 (UTC) Date: Tue, 24 Jul 2018 11:38:00 -0000 From: Tom de Vries To: Richard Biener Cc: gcc-patches@gcc.gnu.org, Jakub Jelinek , Jim Wilson , aoliva@redhat.com Subject: [RFC 3/3, debug] Add fdebug-nops and fkeep-vars-live to Og only Message-ID: <20180724113911.4acg5wyompfxik2i@delia> References:<20180716132909.633uvqxojzgg3wg6@delia> <0e82c00b-a8fc-9f8a-0115-9f7254e1bde1@suse.de> <16bec84d-f6e8-60be-c764-83eb4861b515@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To:<16bec84d-f6e8-60be-c764-83eb4861b515@suse.de> User-Agent: NeoMutt/20170912 (1.9.0) X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg01370.txt.bz2 On Tue, Jul 24, 2018 at 01:30:30PM +0200, Tom de Vries wrote: > On 07/16/2018 05:10 PM, Tom de Vries wrote: > > On 07/16/2018 03:50 PM, Richard Biener wrote: > >> On Mon, 16 Jul 2018, Tom de Vries wrote: > >>> Any comments? > >> > >> Interesting idea. I wonder if that should be generalized > >> to other places > > > > I kept the option name general, to allow for that. > > > > And indeed, this is a point-fix patch. I've been playing around with a > > more generic patch that adds nops such that each is_stmt .loc is > > associated with a unique insn, but that was embedded in an > > fkeep-vars-live branch, so this patch is minimally addressing the first > > problem I managed to reproduce on trunk. > > > >> and how we can avoid compare-debug failures > >> (var-tracking usually doesn't change code-generation). > >> > > > > I'll post this patch series (the current state of my fkeep-vars-live > branch) in reply to this email: > > 1 [debug] Add fdebug-nops > 2 [debug] Add fkeep-vars-live > 3 [debug] Add fdebug-nops and fkeep-vars-live to Og only > > Bootstrapped and reg-tested on x86_64. ChangeLog entries and function > header comments missing. > > Comments welcome. > This switches on fdebug-nops and fkeep-vars-live by default for Og only, in order to excercise the new switches in combination with the optimization option they're intended to be used with. Resulting fixes: ... FAIL: gcc.dg/guality/pr54200.c -Og -DPREVENT_OPTIMIZATION line . z == 3 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+4 a[0] == 1 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+3 a[1] == 2 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+2 a[2] == 3 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 *p == 3 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 2 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+4 a[0] == 1 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+3 a[1] == 2 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+2 a[2] == 13 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 *p == 13 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 2 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+4 a[0] == 1 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+3 a[1] == 12 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+2 a[2] == 13 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 *p == 13 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 12 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+3 a[1] == 5 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+2 a[2] == 6 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 *p == 6 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 5 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+3 a[1] == 5 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+2 a[2] == 26 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 *p == 26 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 5 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+7 a[1] == 25 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+6 a[2] == 26 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+5 *p == 26 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+4 p[-1] == 25 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line .+1 q[1] == 26 FAIL: gcc.dg/guality/pr54970.c -Og -DPREVENT_OPTIMIZATION line . *q == 25 ... The intended nature of Og is: offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience. Todo: assess compile time and runtime cost of adding adding fdebug-nops and fkeep-vars-live to Og, to see if nature of Og has been changed. PR debug/78685 [debug] Add fdebug-nops and fkeep-vars-live to Og only --- gcc/common/common-target.h | 1 + gcc/opts.c | 6 ++++++ gcc/testsuite/gcc.dg/pr84614.c | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/common/common-target.h b/gcc/common/common-target.h index 9b796c8f085..17e8950a027 100644 --- a/gcc/common/common-target.h +++ b/gcc/common/common-target.h @@ -34,6 +34,7 @@ enum opt_levels OPT_LEVELS_1_PLUS, /* -O1 and above, including -Os and -Og. */ OPT_LEVELS_1_PLUS_SPEED_ONLY, /* -O1 and above, but not -Os or -Og. */ OPT_LEVELS_1_PLUS_NOT_DEBUG, /* -O1 and above, but not -Og. */ + OPT_LEVELS_1_DEBUG, /* -Og. */ OPT_LEVELS_2_PLUS, /* -O2 and above, including -Os. */ OPT_LEVELS_2_PLUS_SPEED_ONLY, /* -O2 and above, but not -Os or -Og. */ OPT_LEVELS_3_PLUS, /* -O3 and above. */ diff --git a/gcc/opts.c b/gcc/opts.c index 17d91988ada..e8142eb6920 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -370,6 +370,10 @@ maybe_default_option (struct gcc_options *opts, enabled = (level >= 1 && !debug); break; + case OPT_LEVELS_1_DEBUG: + enabled = (level == 1 && debug); + break; + case OPT_LEVELS_2_PLUS: enabled = (level >= 2); break; @@ -477,6 +481,8 @@ static const struct default_options default_options_table[] = { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fssa_phiopt, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_ftree_builtin_call_dce, NULL, 1 }, { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 }, + { OPT_LEVELS_1_DEBUG, OPT_fdebug_nops, NULL, 1 }, + { OPT_LEVELS_1_DEBUG, OPT_fkeep_vars_live, NULL, 1 }, /* -O2 optimizations. */ { OPT_LEVELS_2_PLUS, OPT_finline_small_functions, NULL, 1 }, diff --git a/gcc/testsuite/gcc.dg/pr84614.c b/gcc/testsuite/gcc.dg/pr84614.c index 98af26ba4e5..b7a5b9c1c84 100644 --- a/gcc/testsuite/gcc.dg/pr84614.c +++ b/gcc/testsuite/gcc.dg/pr84614.c @@ -1,6 +1,6 @@ /* PR target/84614 */ /* { dg-do run { target int128 } } */ -/* { dg-options "-Og -fno-split-wide-types -fno-tree-coalesce-vars -g --param=max-combine-insns=3 -fcompare-debug" } */ +/* { dg-options "-Og -fno-split-wide-types -fno-tree-coalesce-vars -g --param=max-combine-insns=3 -fcompare-debug -fno-debug-nops" } */ unsigned __int128 a;