From: Ken Matsui <kmatsui@cs.washington.edu>
To: Richard Biener <richard.guenther@gmail.com>
Cc: Ken Matsui <kmatsui@gcc.gnu.org>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 0/8] Tweak predicate macros in tree
Date: Wed, 19 Jul 2023 10:27:25 -0700 [thread overview]
Message-ID: <CAML+3pXv1njmJXdJJxD_so80JEthQ_byWWNFX3vuCX_ptw+Rvg@mail.gmail.com> (raw)
In-Reply-To: <CAFiYyc1idiQEh3spsjOOr6FRAGx6c=_gZV313NOquG+egRYiiw@mail.gmail.com>
On Wed, Jul 19, 2023 at 12:08 AM Richard Biener
<richard.guenther@gmail.com> wrote:
>
> On Wed, Jul 19, 2023 at 1:34 AM Ken Matsui via Gcc-patches
> <gcc-patches@gcc.gnu.org> 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, those
> > 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.md#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.
>
Hi Richard,
Thank you for your review! This is because of the comment, which
states that POINTER_TYPE_P should be renamed to INDIRECT_TYPE_P.
/* Nonzero if TYPE represents a pointer or reference type.
(It should be renamed to INDIRECT_TYPE_P.) Keep these checks in
ascending code order. */
#define POINTER_TYPE_P(TYPE) \
(TREE_CODE (TYPE) == POINTER_TYPE || TYPE_REF_P (TYPE))
Also, INDIRECT_TYPE_P is equivalent to POINTER_TYPE_P.
#define INDIRECT_TYPE_P(NODE) \
(TYPE_PTR_P (NODE) || TYPE_REF_P (NODE))
#define TYPE_PTR_P(NODE) \
(TREE_CODE (NODE) == POINTER_TYPE)
IMHO, POINTER_TYPE_P and TYPE_PTR_P are confusing since POINTER_TYPE_P
involves TYPE_REF_P but TYPE_PTR_P does not. If this renaming is still
incorrect, I think we should at least remove the comment in
POINTER_TYPE_P. Could you please confirm whether or not this patch is
correct? Thank you!
Sincerely,
Ken
> > 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
> >
prev parent reply other threads:[~2023-07-19 17:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 23:12 Ken Matsui
2023-07-18 23:12 ` [PATCH 1/8] c++, tree: Move TYPE_REF_P to tree.h Ken Matsui
2023-07-18 23:12 ` [PATCH 2/8] gcc: Use TYPE_REF_P Ken Matsui
2023-07-18 23:12 ` [PATCH 3/8] c++, tree: Move TYPE_PTR_P to tree.h Ken Matsui
2023-07-18 23:12 ` [PATCH 4/8] c++, tree: Move INDIRECT_TYPE_P " Ken Matsui
2023-07-18 23:12 ` [PATCH 5/8] gcc: Use INDIRECT_TYPE_P instead of POINTER_TYPE_P Ken Matsui
2023-07-18 23:12 ` [PATCH 6/8] tree: Remove POINTER_TYPE_P Ken Matsui
2023-07-18 23:12 ` [PATCH 7/8] tree: Define TYPE_REF_IS_LVALUE Ken Matsui
2023-07-18 23:12 ` [PATCH 8/8] c++, lto: Use TYPE_REF_IS_LVALUE Ken Matsui
2023-07-19 7:07 ` [PATCH 0/8] Tweak predicate macros in tree Richard Biener
2023-07-19 17:27 ` Ken Matsui [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAML+3pXv1njmJXdJJxD_so80JEthQ_byWWNFX3vuCX_ptw+Rvg@mail.gmail.com \
--to=kmatsui@cs.washington.edu \
--cc=gcc-patches@gcc.gnu.org \
--cc=kmatsui@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).