From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.CeBiTec.Uni-Bielefeld.DE (smtp.CeBiTec.Uni-Bielefeld.DE [129.70.160.84]) by sourceware.org (Postfix) with ESMTPS id DB6533858CDB for ; Mon, 15 Apr 2024 08:53:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DB6533858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=CeBiTec.Uni-Bielefeld.DE Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cebitec.uni-bielefeld.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DB6533858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=129.70.160.84 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713171209; cv=none; b=DiBsxqIr8IODvjxMV0gcc1eYtP8VngpKhvP/yfZBVtkkmMxMsQUWOwfE2GKqde3und51EnWjPDN9F+oyBrYg5W+BF2Rvj9lfvk3IyxfJW5Sz7JyabicpBuT9/PH55185xRcmLrlGCqAUfm+zX32QWCKIDu4pep7+WGnoD008Zc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1713171209; c=relaxed/simple; bh=cCrT8S0dtZaxJQyC+fXnMCJXRwPGxMn5KTQY2GiKtxA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=laFloNNv/0/KmBXxbhV3GNBC9JgxImRG4tpg6Nd1rh96xsLgqXVkH0xZYC3pugJTLL7H9m+s8oVi9lvSOHiha0C4HMKE63sloxEJeBiABJl/PVMFk0iuf0a1LZRZQ5Mkn5o7CJpuZMgUbj91scGHKPaD/oJQpkxddYUGutEDyuc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost (localhost [127.0.0.1]) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id DEC52CB4F9; Mon, 15 Apr 2024 10:53:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= cebitec.uni-bielefeld.de; h=content-transfer-encoding :content-type:content-type:mime-version:user-agent:message-id :in-reply-to:date:date:references:subject:subject:from:from :received:received; s=20200306; t=1713171202; bh=cCrT8S0dtZaxJQy C+fXnMCJXRwPGxMn5KTQY2GiKtxA=; b=Qr3pcSoWwpRI45424Nqdj2tFgf/fVzQ hSj1AZUeNWNSnD6yQRP+mMKyG/H8bkkCJLaFwyz/VCPXM+xpWS5Sr8662HSw22fH 0BbqLS+yAXZ433vsgAqFObI+Umhun/SOBwWHMLCUBjWURpBiSR1uyN0hEd6yA22s U4sc5SHXF4Jh71QKpngKgkcv5CpsJfao5SfnvmtoLujYmqBvJLZ53TS+1XxYOV6Z sZwkE8skxlxp0PUQxWYRXaBh6WVXvo6AOtvNxORNmOGZdaJMrHqzGzDGHD/mwORF ji/Ky5nC3GNyyg6LY2qDy8uDoyRfgx7Cd1O6tGzqe7YlxXqGlLLj2yw== X-Virus-Scanned: amavisd-new at cebitec.uni-bielefeld.de Received: from smtp.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (smtp.cebitec.uni-bielefeld.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id FlylD2tF3dUI; Mon, 15 Apr 2024 10:53:22 +0200 (CEST) Received: from manam.CeBiTec.Uni-Bielefeld.DE (p50855b96.dip0.t-ipconnect.de [80.133.91.150]) (Authenticated sender: ro) by smtp.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPSA id A84B7CB8AC; Mon, 15 Apr 2024 10:53:22 +0200 (CEST) From: Rainer Orth To: =?utf-8?Q?J=C3=B8rgen?= Kvalsvik Cc: Jan Hubicka , gcc-patches@gcc.gnu.org, richard.guenther@gmail.com Subject: Re: [PATCH v10 1/2] Add condition coverage (MC/DC) References: <20240223111800.1209438-1-j@lambda.is> <7033a2f7-42de-4bb3-a99a-28a35995c4a2@lambda.is> Date: Mon, 15 Apr 2024 10:53:22 +0200 In-Reply-To: <7033a2f7-42de-4bb3-a99a-28a35995c4a2@lambda.is> (=?utf-8?Q?=22J=C3=B8rgen?= Kvalsvik"'s message of "Thu, 4 Apr 2024 14:54:18 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1.90 (usg-unix-v) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3790.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi J=C3=B8rgen, > On 04/04/2024 14:10, Jan Hubicka wrote: >>> gcc/ChangeLog: >>> >>> * builtins.cc (expand_builtin_fork_or_exec): Check >>> condition_coverage_flag. >>> * collect2.cc (main): Add -fno-condition-coverage to OBSTACK. >>> * common.opt: Add new options -fcondition-coverage and >>> -Wcoverage-too-many-conditions. >>> * doc/gcov.texi: Add --conditions documentation. >>> * doc/invoke.texi: Add -fcondition-coverage documentation. >>> * function.cc (free_after_compilation): Free cond_uids. >>> * function.h (struct function): Add cond_uids. >>> * gcc.cc: Link gcov on -fcondition-coverage. >>> * gcov-counter.def (GCOV_COUNTER_CONDS): New. >>> * gcov-dump.cc (tag_conditions): New. >>> * gcov-io.h (GCOV_TAG_CONDS): New. >>> (GCOV_TAG_CONDS_LENGTH): New. >>> (GCOV_TAG_CONDS_NUM): New. >>> * gcov.cc (class condition_info): New. >>> (condition_info::condition_info): New. >>> (condition_info::popcount): New. >>> (struct coverage_info): New. >>> (add_condition_counts): New. >>> (output_conditions): New. >>> (print_usage): Add -g, --conditions. >>> (process_args): Likewise. >>> (output_intermediate_json_line): Output conditions. >>> (read_graph_file): Read condition counters. >>> (read_count_file): Likewise. >>> (file_summary): Print conditions. >>> (accumulate_line_info): Accumulate conditions. >>> (output_line_details): Print conditions. >>> * gimplify.cc (next_cond_uid): New. >>> (reset_cond_uid): New. >>> (shortcut_cond_r): Set condition discriminator. >>> (tag_shortcut_cond): New. >>> (gimple_associate_condition_with_expr): New. >>> (shortcut_cond_expr): Set condition discriminator. >>> (gimplify_cond_expr): Likewise. >>> (gimplify_function_tree): Call reset_cond_uid. >>> * ipa-inline.cc (can_early_inline_edge_p): Check >>> condition_coverage_flag. >>> * ipa-split.cc (pass_split_functions::gate): Likewise. >>> * passes.cc (finish_optimization_passes): Likewise. >>> * profile.cc (struct condcov): New declaration. >>> (cov_length): Likewise. >>> (cov_blocks): Likewise. >>> (cov_masks): Likewise. >>> (cov_maps): Likewise. >>> (cov_free): Likewise. >>> (instrument_decisions): New. >>> (read_thunk_profile): Control output to file. >>> (branch_prob): Call find_conditions, instrument_decisions. >>> (init_branch_prob): Add total_num_conds. >>> (end_branch_prob): Likewise. >>> * tree-core.h (struct tree_exp): Add condition_uid. >>> * tree-profile.cc (struct conds_ctx): New. >>> (CONDITIONS_MAX_TERMS): New. >>> (EDGE_CONDITION): New. >>> (topological_cmp): New. >>> (index_of): New. >>> (single_p): New. >>> (single_edge): New. >>> (contract_edge_up): New. >>> (struct outcomes): New. >>> (conditional_succs): New. >>> (condition_index): New. >>> (condition_uid): New. >>> (masking_vectors): New. >>> (emit_assign): New. >>> (emit_bitwise_op): New. >>> (make_top_index_visit): New. >>> (make_top_index): New. >>> (paths_between): New. >>> (struct condcov): New. >>> (cov_length): New. >>> (cov_blocks): New. >>> (cov_masks): New. >>> (cov_maps): New. >>> (cov_free): New. >>> (find_conditions): New. >>> (struct counters): New. >>> (find_counters): New. >>> (resolve_counter): New. >>> (resolve_counters): New. >>> (instrument_decisions): New. >>> (tree_profiling): Check condition_coverage_flag. >>> (pass_ipa_tree_profile::gate): Likewise. >>> * tree.h (SET_EXPR_UID): New. >>> (EXPR_COND_UID): New. >>> >>> libgcc/ChangeLog: >>> >>> * libgcov-merge.c (__gcov_merge_ior): New. >>> >>> gcc/testsuite/ChangeLog: >>> >>> * lib/gcov.exp: Add condition coverage test function. >>> * g++.dg/gcov/gcov-18.C: New test. >>> * gcc.misc-tests/gcov-19.c: New test. >>> * gcc.misc-tests/gcov-20.c: New test. >>> * gcc.misc-tests/gcov-21.c: New test. >>> * gcc.misc-tests/gcov-22.c: New test. >>> * gcc.misc-tests/gcov-23.c: New test. >>> --- >>> gcc/builtins.cc | 2 +- >>> gcc/collect2.cc | 7 +- >>> gcc/common.opt | 9 + >>> gcc/doc/gcov.texi | 38 + >>> gcc/doc/invoke.texi | 21 + >>> gcc/function.cc | 1 + >>> gcc/function.h | 4 + >>> gcc/gcc.cc | 4 +- >>> gcc/gcov-counter.def | 3 + >>> gcc/gcov-dump.cc | 24 + >>> gcc/gcov-io.h | 3 + >>> gcc/gcov.cc | 209 ++- >>> gcc/gimplify.cc | 123 +- >>> gcc/ipa-inline.cc | 2 +- >>> gcc/ipa-split.cc | 2 +- >>> gcc/passes.cc | 3 +- >>> gcc/profile.cc | 76 +- >>> gcc/testsuite/g++.dg/gcov/gcov-18.C | 282 ++++ >>> gcc/testsuite/gcc.misc-tests/gcov-19.c | 1737 ++++++++++++++++++++++++ >>> gcc/testsuite/gcc.misc-tests/gcov-20.c | 22 + >>> gcc/testsuite/gcc.misc-tests/gcov-21.c | 16 + >>> gcc/testsuite/gcc.misc-tests/gcov-22.c | 103 ++ >>> gcc/testsuite/gcc.misc-tests/gcov-23.c | 361 +++++ >>> gcc/testsuite/lib/gcov.exp | 259 +++- >>> gcc/tree-core.h | 3 + >>> gcc/tree-profile.cc | 1058 ++++++++++++++- >>> gcc/tree.h | 4 + >>> libgcc/libgcov-merge.c | 5 + >>> 28 files changed, 4339 insertions(+), 42 deletions(-) >>> create mode 100644 gcc/testsuite/g++.dg/gcov/gcov-18.C >>> create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-19.c >>> create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-20.c >>> create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-21.c >>> create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-22.c >>> create mode 100644 gcc/testsuite/gcc.misc-tests/gcov-23.c >>> >>> --- >>> Changes since v9: >>> >>> * function->cond_uid is no longer in ggc memory >>> * function->cond_uid and condition annotation is only done when coverage >>> is requested >>> * A few new test cases, notably interactions with C++ constexpr >>> * Updated comments based on review feedback >>> --- >>> >>=20 >>> diff --git a/gcc/ipa-inline.cc b/gcc/ipa-inline.cc >>> index dc120e6da5a..9502a21c741 100644 >>> --- a/gcc/ipa-inline.cc >>> +++ b/gcc/ipa-inline.cc >>> @@ -682,7 +682,7 @@ can_early_inline_edge_p (struct cgraph_edge *e) >>> } >>> gcc_assert (gimple_in_ssa_p (DECL_STRUCT_FUNCTION (e->caller->decl)) >>> && gimple_in_ssa_p (DECL_STRUCT_FUNCTION (callee->decl))); >>> - if (profile_arc_flag >>> + if ((profile_arc_flag || condition_coverage_flag) >>> && ((lookup_attribute ("no_profile_instrument_function", >>> DECL_ATTRIBUTES (caller->decl)) =3D=3D NULL_TREE) >>> !=3D (lookup_attribute ("no_profile_instrument_function", >> tree-inline should also copy the cond tags, since always_inline >> functions are inlined even at -O0. But I think this can be done >> incrementally. >> Patch is OK. >> Thanks a lot and sorry for taking so long on this one. >> Honza > > I guess you mean that since tree-inlining happen after gimplification (do= es > it?) that the basic condition -> condition expression association should > also fold in the now-inlined conditions? > > Thanks for the review - I'll do a final test run and install the patch. the new gcc.misc-tests/gcov-22.c test loops on SPARC (both Solaris and Linux). I've filed PR gcov-profile/114720 for this, but couldn't find any bugzilla account of yours to Cc: Rainer --=20 ---------------------------------------------------------------------------= -- Rainer Orth, Center for Biotechnology, Bielefeld University