From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 6B4203858D39 for ; Tue, 9 Nov 2021 14:38:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6B4203858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 48F3121AFE; Tue, 9 Nov 2021 14:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1636468687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NHImjHSeCvwhE3kzSFh1qSh13oel2WPomExZxwNDMYw=; b=EDoV6oa+CRvX6/0UUY+Umpb7l/1hfSFnkP06mDYYVOR4B4PbE3JP1MxYsjZ/+q5vysc3om KX9l2aNpApQ8PYL/Q0UysVA+SNF6XAHohueKndACSNBEmRaNlgAM+6V21xvEjIEsBaLWQ1 W6eIAAdCg9xnB3m+YeDlTXBaxOq+5Fc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1636468687; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NHImjHSeCvwhE3kzSFh1qSh13oel2WPomExZxwNDMYw=; b=3QvGRGEj5rzd0YfXg/DtPZAf2K8zxchKw48MYztTms3c4/10CwvkJdlKWhmoDEd0cZgGkU AOmkmkCZzJLoMIAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 33D4413A1F; Tue, 9 Nov 2021 14:38:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9ValC8+HimH3egAAMHmgww (envelope-from ); Tue, 09 Nov 2021 14:38:07 +0000 Message-ID: Date: Tue, 9 Nov 2021 15:38:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: Use 'location_hash' for 'seen_locations' in 'gcc/profile.c:branch_prob' (was: [PATCH] Fix GCOV CFG related issues) Content-Language: en-US To: Thomas Schwinge , gcc-patches@gcc.gnu.org Cc: Nathan Sidwell References: <87fss5xv08.fsf@euler.schwinge.homeip.net> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <87fss5xv08.fsf@euler.schwinge.homeip.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2021 14:38:10 -0000 On 11/9/21 15:29, Thomas Schwinge wrote: > Hi! > > On 2018-07-25T15:40:24+0200, Martin Liška wrote: >> --- a/gcc/profile.c >> +++ b/gcc/profile.c >> @@ -1256,6 +1256,8 @@ branch_prob (void) >> /* Initialize the output. */ >> output_location (NULL, 0, NULL, NULL); >> >> + hash_set > seen_locations; >> + >> FOR_EACH_BB_FN (bb, cfun) >> { >> gimple_stmt_iterator gsi; > > Given my recent commit 088199e5d0fc0d54f48af0783a2630a773bbb387 > "Generalize 'gcc/input.h:struct location_hash'", OK to push the attached > "Use 'location_hash' for 'seen_locations' in 'gcc/profile.c:branch_prob'"? Yes, thanks. Martin > > > Grüße > Thomas > > >> @@ -1263,8 +1265,9 @@ branch_prob (void) >> >> if (bb == ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb) >> { >> - expanded_location curr_location = >> - expand_location (DECL_SOURCE_LOCATION (current_function_decl)); >> + location_t loc = DECL_SOURCE_LOCATION (current_function_decl); >> + seen_locations.add (loc); >> + expanded_location curr_location = expand_location (loc); >> output_location (curr_location.file, curr_location.line, >> &offset, bb); >> } >> @@ -1272,17 +1275,25 @@ branch_prob (void) >> for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) >> { >> gimple *stmt = gsi_stmt (gsi); >> - if (!RESERVED_LOCATION_P (gimple_location (stmt))) >> - output_location (gimple_filename (stmt), gimple_lineno (stmt), >> - &offset, bb); >> + location_t loc = gimple_location (stmt); >> + if (!RESERVED_LOCATION_P (loc)) >> + { >> + seen_locations.add (loc); >> + output_location (gimple_filename (stmt), gimple_lineno (stmt), >> + &offset, bb); >> + } >> } >> >> - /* Notice GOTO expressions eliminated while constructing the CFG. */ >> + /* Notice GOTO expressions eliminated while constructing the CFG. >> + It's hard to distinguish such expression, but goto_locus should >> + not be any of already seen location. */ >> + location_t loc; >> if (single_succ_p (bb) >> - && !RESERVED_LOCATION_P (single_succ_edge (bb)->goto_locus)) >> + && (loc = single_succ_edge (bb)->goto_locus) >> + && !RESERVED_LOCATION_P (loc) >> + && !seen_locations.contains (loc)) >> { >> - expanded_location curr_location >> - = expand_location (single_succ_edge (bb)->goto_locus); >> + expanded_location curr_location = expand_location (loc); >> output_location (curr_location.file, curr_location.line, >> &offset, bb); >> } > > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955 >