From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id 867BF3858D32; Wed, 19 Jul 2023 07:08:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 867BF3858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b95d5ee18dso2206301fa.1; Wed, 19 Jul 2023 00:08:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689750507; x=1692342507; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MfMj1xNURFonnG5hNshGO3RUuzadZK9abDZngN1ESKo=; b=pyMtSGKIPHhTZIx5/jB1eektbGTJzqpE3gyr9D585Z4cDvnIAtwn/SpsRBho0q7pUC 0oe+bwh56CCOPEldxNCdDCwZauRnrEmjR9WrLqt0ZrEcPj4kf69d7b0Kcv51R3MUa1+t sE4m2GqmW0RlcidMaX4tRgy9UZV+dXshCJ+oWvyZw4TRh+Kp+txV5PChSRWMWXEU7TRZ dMdBuaXz4WzAIPeLiunv+xf366s2d8t53BnBSErI/7Dp1ofPZdiLQSEhs/dluGxz7wQ2 B5JZjujt2phCcFESKzwF6w7OQT9Bco499Zvug9G9ZbCpMNrrnhWlw8jw8NoKZPFbQQ8R mshA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689750507; x=1692342507; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MfMj1xNURFonnG5hNshGO3RUuzadZK9abDZngN1ESKo=; b=WM3epP9JCb5uxDuim+QN7qEbX4ev9TCxQ8WFx46/tiVGVUtM7OhvIMRGtW6woKzilb rVy1F1eiLlekDOUyfyIkdT87B/b5dUFKI+08ryR/3BTJKLVTpB4ZN/F1vuGX2VdRCBt8 JOjKDOs7cKScvmq+cz4UomzDM8i7GQRsxbZ7lIm+dH7n46Z/jTY5k6SdteSpVX476Xjp reA31/JpKmm/Sxm1IZKtOUrFea5TFEOoybg9HXZ6NZ2399Spv8SjemfzlT9wuR/7CRwv Kw0W2m0ffwdVL8Lwd3GtIfJGCYHyTCxdoWlnoTwXOqgKrAb67JelauQ//eQChmm8iTs+ J1Rw== X-Gm-Message-State: ABy/qLbHhkiPq+XHZIfThIJEL8V3BUqISBLZn7DpxmXcBojg7cg20EpW Kyf7vaT79ffkw7UdJy+zDU3I4ZBMQRK0ZIDjQnpgOMQM X-Google-Smtp-Source: APBJJlHt6vb7AY9tJiRRP4a0VwXjmmy2+pM8LP8vlPJ7Bry4/9l727lu/+Pv87vgBmJJltyaL5pS62N+lKoZemniu/c= X-Received: by 2002:a2e:880a:0:b0:2b6:df15:f6c3 with SMTP id x10-20020a2e880a000000b002b6df15f6c3mr13197865ljh.39.1689750506487; Wed, 19 Jul 2023 00:08:26 -0700 (PDT) MIME-Version: 1.0 References: <20230718233301.28677-1-kmatsui@gcc.gnu.org> In-Reply-To: <20230718233301.28677-1-kmatsui@gcc.gnu.org> From: Richard Biener Date: Wed, 19 Jul 2023 09:07:53 +0200 Message-ID: Subject: Re: [PATCH 0/8] Tweak predicate macros in tree To: Ken Matsui Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On Wed, Jul 19, 2023 at 1:34=E2=80=AFAM Ken Matsui via Gcc-patches wrote: > > This patch series tweaks predicate macros in tree.h to make the code more > readable. TYPE_REF_P is moved to tree.h and used for INDIRECT_TYPE_P and > TYPE_REF_IS_LVALUE. TYPE_PTR_P is also moved to tree.h and used for > INDIRECT_TYPE_P. POINTER_TYPE_P in tree.h is replaced with INDIRECT_TYPE_= P > since it is ambiguous. TYPE_REF_IS_LVALUE is defined in tree.h through > TYPE_REF_P and TYPE_REF_IS_RVALUE. The same behavior codes with those > predicate macros are replaced for clarity. > > These works were all the way up to implementing __is_lvalue_reference > built-in trait and optimizing the is_lvalue_reference trait. However, tho= se > changes were dropped since I did not observe any performance improvements= . > For those who are interested in the benchmark results, they can be found > below: > > 1. is_lvalue_reference > > https://github.com/ken-matsui/gcc-benches/blob/main/is_lvalue_reference.m= d#tue-jul-18-033708-pm-pdt-2023 > > Time: +1.35432% > Peak Memory Usage: -0.103283% > Total Memory Usage: No difference > > 2. is_lvalue_reference_v > > https://github.com/ken-matsui/gcc-benches/blob/main/is_lvalue_reference_v= .md#tue-jul-18-034236-pm-pdt-2023 > > Time: No difference > Peak Memory Usage: -0.426872% > Total Memory Usage: -0.677638% > > Ken Matsui (8): > c++, tree: Move TYPE_REF_P to tree.h > gcc: Use TYPE_REF_P > c++, tree: Move TYPE_PTR_P to tree.h > c++, tree: Move INDIRECT_TYPE_P to tree.h > gcc: Use INDIRECT_TYPE_P instead of POINTER_TYPE_P No, please not. Definitely not. The tree code of POINTER_TYPE_P is POINTER_TYPE so the predicate name is exactly correct. REFERENCE_TYPE_P would be the canonical predicate for REFERENCE_TYPE, not TYPE_REF_P. I don't think the C++ frontend should be the one to decide about middle-end tree predicate macros. > tree: Remove POINTER_TYPE_P > tree: Define TYPE_REF_IS_LVALUE > c++, lto: Use TYPE_REF_IS_LVALUE > > gcc/ada/gcc-interface/ada-tree.h | 2 +- > gcc/ada/gcc-interface/decl.cc | 6 +- > gcc/ada/gcc-interface/trans.cc | 16 +-- > gcc/ada/gcc-interface/utils.cc | 12 +- > gcc/ada/gcc-interface/utils2.cc | 14 +- > gcc/alias.cc | 12 +- > gcc/analyzer/analyzer.cc | 4 +- > gcc/analyzer/call-details.h | 2 +- > gcc/analyzer/call-summary.cc | 2 +- > gcc/analyzer/checker-event.cc | 4 +- > gcc/analyzer/constraint-manager.cc | 2 +- > gcc/analyzer/engine.cc | 4 +- > gcc/analyzer/program-state.cc | 2 +- > gcc/analyzer/region-model-manager.cc | 6 +- > gcc/analyzer/region-model.cc | 6 +- > gcc/analyzer/sm.cc | 4 +- > gcc/analyzer/svalue.cc | 2 +- > gcc/analyzer/varargs.cc | 2 +- > gcc/asan.cc | 4 +- > gcc/builtins.cc | 24 ++-- > gcc/c-family/c-ada-spec.cc | 2 +- > gcc/c-family/c-attribs.cc | 32 ++--- > gcc/c-family/c-common.cc | 41 +++--- > gcc/c-family/c-omp.cc | 8 +- > gcc/c-family/c-pretty-print.cc | 4 +- > gcc/c-family/c-ubsan.cc | 10 +- > gcc/c-family/c-warn.cc | 34 ++--- > gcc/c/c-decl.cc | 8 +- > gcc/c/c-parser.cc | 4 +- > gcc/c/c-typeck.cc | 40 +++--- > gcc/c/gimple-parser.cc | 8 +- > gcc/calls.cc | 2 +- > gcc/cfgexpand.cc | 6 +- > gcc/cgraph.cc | 2 +- > gcc/cgraphunit.cc | 2 +- > gcc/config/aarch64/aarch64-builtins.cc | 2 +- > gcc/config/aarch64/aarch64-sve-builtins.cc | 2 +- > gcc/config/aarch64/aarch64.cc | 6 +- > gcc/config/arc/arc.cc | 2 +- > gcc/config/arm/arm-builtins.cc | 6 +- > gcc/config/arm/arm-mve-builtins.cc | 2 +- > gcc/config/avr/avr.cc | 6 +- > gcc/config/epiphany/epiphany.cc | 2 +- > gcc/config/gcn/gcn-tree.cc | 2 +- > gcc/config/gcn/gcn.cc | 6 +- > gcc/config/i386/i386-builtins.cc | 2 +- > gcc/config/i386/i386-options.cc | 2 +- > gcc/config/i386/i386.cc | 10 +- > gcc/config/m32c/m32c.cc | 2 +- > gcc/config/m68k/m68k.cc | 4 +- > gcc/config/mips/mips.cc | 2 +- > gcc/config/mn10300/mn10300.cc | 2 +- > gcc/config/msp430/msp430.cc | 2 +- > gcc/config/nios2/nios2.cc | 2 +- > gcc/config/pa/pa.cc | 4 +- > gcc/config/pru/pru-passes.cc | 2 +- > gcc/config/pru/pru.cc | 2 +- > gcc/config/rs6000/rs6000-builtin.cc | 4 +- > gcc/config/rs6000/rs6000-c.cc | 10 +- > gcc/config/rs6000/rs6000.cc | 4 +- > gcc/config/s390/s390-c.cc | 2 +- > gcc/config/s390/s390.cc | 12 +- > gcc/config/sparc/sparc.cc | 2 +- > gcc/convert.cc | 4 +- > gcc/cp/class.cc | 4 +- > gcc/cp/constexpr.cc | 8 +- > gcc/cp/coroutines.cc | 4 +- > gcc/cp/cp-gimplify.cc | 2 +- > gcc/cp/cp-tree.h | 12 -- > gcc/cp/decl.cc | 5 +- > gcc/cp/init.cc | 5 +- > gcc/cp/method.cc | 5 +- > gcc/cp/pt.cc | 8 +- > gcc/cp/semantics.cc | 18 +-- > gcc/cp/tree.cc | 2 +- > gcc/cp/typeck.cc | 4 +- > gcc/d/d-attribs.cc | 6 +- > gcc/d/d-builtins.cc | 2 +- > gcc/d/d-codegen.cc | 12 +- > gcc/d/d-convert.cc | 12 +- > gcc/d/expr.cc | 10 +- > gcc/d/intrinsics.cc | 12 +- > gcc/dojump.cc | 4 +- > gcc/dwarf2out.cc | 2 +- > gcc/emit-rtl.cc | 2 +- > gcc/expmed.cc | 2 +- > gcc/expr.cc | 22 +-- > gcc/fold-const.cc | 58 ++++---- > gcc/fortran/trans-array.cc | 36 ++--- > gcc/fortran/trans-decl.cc | 32 ++--- > gcc/fortran/trans-expr.cc | 106 +++++++------- > gcc/fortran/trans-intrinsic.cc | 28 ++-- > gcc/fortran/trans-io.cc | 8 +- > gcc/fortran/trans-openmp.cc | 88 ++++++------ > gcc/fortran/trans-stmt.cc | 14 +- > gcc/fortran/trans-types.cc | 8 +- > gcc/fortran/trans.cc | 14 +- > gcc/function-abi.cc | 2 +- > gcc/function.cc | 6 +- > gcc/gimple-array-bounds.cc | 6 +- > gcc/gimple-expr.cc | 8 +- > gcc/gimple-fold.cc | 20 +-- > gcc/gimple-loop-versioning.cc | 4 +- > gcc/gimple-low.cc | 2 +- > gcc/gimple-pretty-print.cc | 4 +- > gcc/gimple-range-cache.cc | 4 +- > gcc/gimple-range-fold.cc | 2 +- > gcc/gimple-range-infer.cc | 2 +- > gcc/gimple-range-path.cc | 4 +- > gcc/gimple-ssa-isolate-paths.cc | 6 +- > gcc/gimple-ssa-nonnull-compare.cc | 4 +- > gcc/gimple-ssa-sprintf.cc | 4 +- > gcc/gimple-ssa-store-merging.cc | 6 +- > gcc/gimple-ssa-strength-reduction.cc | 22 +-- > gcc/gimple-ssa-warn-access.cc | 8 +- > gcc/gimple-ssa-warn-restrict.cc | 6 +- > gcc/gimple.cc | 10 +- > gcc/gimplify.cc | 44 +++--- > gcc/go/go-gcc.cc | 2 +- > gcc/godump.cc | 4 +- > gcc/graphite-isl-ast-to-gimple.cc | 8 +- > gcc/graphite-sese-to-poly.cc | 2 +- > gcc/ipa-cp.cc | 4 +- > gcc/ipa-devirt.cc | 8 +- > gcc/ipa-free-lang-data.cc | 8 +- > gcc/ipa-icf-gimple.cc | 2 +- > gcc/ipa-icf.cc | 6 +- > gcc/ipa-modref-tree.cc | 2 +- > gcc/ipa-modref.cc | 8 +- > gcc/ipa-param-manipulation.cc | 4 +- > gcc/ipa-polymorphic-call.cc | 6 +- > gcc/ipa-prop.cc | 28 ++-- > gcc/ipa-sra.cc | 4 +- > gcc/jit/dummy-frontend.cc | 2 +- > gcc/langhooks.cc | 2 +- > gcc/lto-streamer-out.cc | 4 +- > gcc/lto/lto-common.cc | 10 +- > gcc/lto/lto-lang.cc | 2 +- > gcc/lto/lto-symtab.cc | 2 +- > gcc/m2/gm2-gcc/m2expr.cc | 12 +- > gcc/m2/gm2-gcc/m2tree.cc | 2 +- > gcc/m2/gm2-gcc/m2treelib.cc | 2 +- > gcc/m2/m2pp.cc | 4 +- > gcc/match.pd | 48 +++---- > gcc/objc/objc-act.cc | 32 ++--- > gcc/objc/objc-encoding.cc | 2 +- > gcc/objc/objc-gnu-runtime-abi-01.cc | 4 +- > gcc/objc/objc-next-runtime-abi-01.cc | 4 +- > gcc/objc/objc-next-runtime-abi-02.cc | 6 +- > gcc/omp-expand.cc | 156 ++++++++++----------- > gcc/omp-general.cc | 10 +- > gcc/omp-low.cc | 45 +++--- > gcc/omp-oacc-neuter-broadcast.cc | 8 +- > gcc/omp-offload.cc | 2 +- > gcc/omp-simd-clone.cc | 28 ++-- > gcc/pointer-query.cc | 12 +- > gcc/predict.cc | 4 +- > gcc/range-op.cc | 4 +- > gcc/rust/backend/rust-tree.cc | 2 +- > gcc/rust/rust-gcc.cc | 2 +- > gcc/sese.cc | 2 +- > gcc/tree-affine.cc | 12 +- > gcc/tree-cfg.cc | 38 ++--- > gcc/tree-chrec.cc | 14 +- > gcc/tree-chrec.h | 4 +- > gcc/tree-core.h | 2 +- > gcc/tree-data-ref.cc | 18 +-- > gcc/tree-dfa.cc | 2 +- > gcc/tree-if-conv.cc | 4 +- > gcc/tree-inline.cc | 10 +- > gcc/tree-nested.cc | 8 +- > gcc/tree-object-size.cc | 10 +- > gcc/tree-outof-ssa.cc | 2 +- > gcc/tree-pretty-print.cc | 8 +- > gcc/tree-profile.cc | 2 +- > gcc/tree-scalar-evolution.cc | 8 +- > gcc/tree-sra.cc | 2 +- > gcc/tree-ssa-address.cc | 6 +- > gcc/tree-ssa-alias.cc | 18 +-- > gcc/tree-ssa-ccp.cc | 22 +-- > gcc/tree-ssa-copy.cc | 4 +- > gcc/tree-ssa-dom.cc | 2 +- > gcc/tree-ssa-dse.cc | 2 +- > gcc/tree-ssa-forwprop.cc | 6 +- > gcc/tree-ssa-ifcombine.cc | 2 +- > gcc/tree-ssa-loop-ch.cc | 2 +- > gcc/tree-ssa-loop-ivopts.cc | 44 +++--- > gcc/tree-ssa-loop-manip.cc | 10 +- > gcc/tree-ssa-loop-niter.cc | 40 +++--- > gcc/tree-ssa-loop-split.cc | 10 +- > gcc/tree-ssa-phiopt.cc | 2 +- > gcc/tree-ssa-phiprop.cc | 2 +- > gcc/tree-ssa-reassoc.cc | 14 +- > gcc/tree-ssa-sccvn.cc | 6 +- > gcc/tree-ssa-strlen.cc | 10 +- > gcc/tree-ssa-structalias.cc | 14 +- > gcc/tree-ssa-threadedge.cc | 2 +- > gcc/tree-ssa-uninit.cc | 10 +- > gcc/tree-ssa.cc | 2 +- > gcc/tree-ssanames.cc | 22 +-- > gcc/tree-stdarg.cc | 6 +- > gcc/tree-streamer-in.cc | 2 +- > gcc/tree-streamer-out.cc | 2 +- > gcc/tree-tailcall.cc | 8 +- > gcc/tree-vect-data-refs.cc | 4 +- > gcc/tree-vect-loop-manip.cc | 2 +- > gcc/tree-vect-loop.cc | 4 +- > gcc/tree-vect-stmts.cc | 18 +-- > gcc/tree-vrp.cc | 6 +- > gcc/tree.cc | 64 ++++----- > gcc/tree.h | 30 ++-- > gcc/ubsan.cc | 18 +-- > gcc/value-pointer-equiv.cc | 4 +- > gcc/value-pointer-equiv.h | 2 +- > gcc/value-query.cc | 12 +- > gcc/value-range.h | 6 +- > gcc/var-tracking.cc | 6 +- > gcc/varasm.cc | 10 +- > gcc/vr-values.cc | 6 +- > 219 files changed, 1139 insertions(+), 1148 deletions(-) > > -- > 2.41.0 >