public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Tweak predicate macros in tree
@ 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
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Ken Matsui @ 2023-07-18 23:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ken Matsui

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
  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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-07-19 17:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 23:12 [PATCH 0/8] Tweak predicate macros in tree 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 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).