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 AF8413857413 for ; Thu, 7 Apr 2022 12:04:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF8413857413 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 64B5E210EA; Thu, 7 Apr 2022 12:04:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1649333051; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zBw9Znls7y+VLsfJB3jHxdA4xqpi7+ax5/FW48zRkbs=; b=FLXaTbvOAx2+z21AvNWga4UlVU4bNE0Vho9/vn30H4Rqt1az7EhiPlgyJE/UZ7fauHKc+X 7aKuYKt1GfrEDognuFVfmoyvVxb3HTDEbOje/6PnVEeZ998l6QNJ6j3Epnb7QqDEUzw92i EOVG+F5w2msBqZgGWsvQyv5uV3jqAVo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1649333051; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zBw9Znls7y+VLsfJB3jHxdA4xqpi7+ax5/FW48zRkbs=; b=IyvyRtLwTN61JGOYc6BNGRoUDknkfmXWjZwaECSKDLOeBDQ5B9X6LjF2ECt0daYLa0pfwl wwyY6jFUWvllOcDQ== 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 4E30313485; Thu, 7 Apr 2022 12:04:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WmcWETvTTmK8AgAAMHmgww (envelope-from ); Thu, 07 Apr 2022 12:04:11 +0000 Message-ID: Date: Thu, 7 Apr 2022 14:04:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] Add condition coverage profiling Content-Language: en-US To: =?UTF-8?Q?J=c3=b8rgen_Kvalsvik?= , gcc-patches@gcc.gnu.org References: <8041d06d-219d-c83a-ff8f-9c75227cb072@woven-planet.global> <8ea26b0e-40e2-9e7c-4470-5add7a02a074@woven-planet.global> From: =?UTF-8?Q?Martin_Li=c5=a1ka?= In-Reply-To: <8ea26b0e-40e2-9e7c-4470-5add7a02a074@woven-planet.global> 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, T_SCC_BODY_TEXT_LINE 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: Thu, 07 Apr 2022 12:04:15 -0000 On 3/28/22 16:40, Jørgen Kvalsvik via Gcc-patches wrote: > ... And with another tiny change that fixes Martin's while (1); case. Hello. Back to this ;) Thank you for the updated version of the patch. I have a couple of comments/requests: 1) I noticed the following cannot be linked: $ cat errors.C char trim_filename_name; int r; void trim_filename() { if (trim_filename_name) r = 123; while (trim_filename_name) ; } int main() {} $ g++ errors.C -fprofile-conditions -O2 mold: error: undefined symbol: /tmp/ccmZANB5.o: __gcov8._Z13trim_filenamev collect2: error: ld returned 1 exit status Btw. how much have you tested the patch set so far? Have you tried building something bigger with -fprofile-conditions enabled? 2) As noticed by Sebastian, please support the new tag in gcov-dump: $ gcov-dump -l a.gcno ... a.gcno: 01450000: 28:LINES a.gcno: block 7:`a.c':11 a.gcno: 01470000: 8:UNKNOWN 3) Then I have some top-level formatting comments: a) please re-run check_GNU_style.py, I still see: === ERROR type #1: blocks of 8 spaces should be replaced with tabs (35 error(s)) === ... b) write comments for each newly added function (and separate it by one empty line from the function definition) c) do not create visual alignment, we don't use it: + cond->set ("count", new json::integer_number (count)); + cond->set ("covered", new json::integer_number (covered)); and similar examples d) finish multiple comments after a dot on the same line: + /* Number of expressions found - this value is the number of entries in the + gcov output and the parameter to gcov_counter_alloc (). + */ should be ... gcov_counter_alloc (). */ e) for long lines with a function call like: + const int n = find_conditions_masked_by + (block, expr, flags + k, path, CONDITIONS_MAX_TERMS); do rather const int n = find_conditions_masked_by (block, expr, next_arg, ...); f) for function params: +int +collect_reachable_conditionals ( + basic_block pre, + basic_block post, + basic_block *out, + int maxsize, + sbitmap expr) use rather: int collect_reachable_conditionals (basic_block pre, second_arg,... In the next round, I'm going to take a look at the CFG algorithm that identifies and instruments the sub-expressions. Thanks. Cheers, Martin