mbox series

[00/17] improve expansion of constant symbols

Message ID 20191210225921.94897-1-luc.vanoostenryck@gmail.com (mailing list archive)
Headers show
Series improve expansion of constant symbols | expand

Message

Luc Van Oostenryck Dec. 10, 2019, 10:59 p.m. UTC
This series looks as trying to improve an optimization but
is in fact the result of a (failed) attempt to improve
the diagnostic of non-constant initializers. Such diagnostics
are currently only given with -Wconstexpr-not-const which
follows the rather strict rules given by the standard for
constant expressions. These rules can be handled at
evaluation time, when the diagnostics are currently issued
but we want, at least by default, to accept more general
expressions as being constant, maybe anything with a value
known at compile time. This can only be done later, at
expansion time.


Luc Van Oostenryck (17):
  split testcases for type punning & constant initializer expansion
  add testcase for expansion of default initializers
  add testcase for addressability of degenerated symbol
  add testcase for addressability of 'complex' symbols
  add test for union cast
  add test for dereference cost of symbol with complex type
  add test for constant expansion of complex initializer
  extract mark_addressable() from evaluate_addressof().
  fix addressability marking in evaluate_addressof()
  degenerated arrays & functions are addressable too
  fix expansion of initializer (mismatching size)
  fix expansion of initializer (mismatching type)
  fix expansion of initializer (default)
  fix simplify_loads() when doing type punning
  fix cost of dereference of symbols with complex type
  RFC: allow expansion of accessed constants if 'static const'
  constant expansion of strings

 evaluate.c                                    |  16 ++-
 expand.c                                      | 124 ++++++++++++++++--
 memops.c                                      |  11 ++
 validation/eval/addressable-complex.c         |  23 ++++
 validation/eval/addressable-degen.c           |  17 +++
 validation/expand/constant-init-array.c       |  15 +++
 .../expand/constant-init-nested-array.c       |  15 +++
 .../expand/constant-init-nested-struct.c      |  23 ++++
 validation/expand/constant-init-string.c      |  14 ++
 validation/expand/constant-static.c           |  16 +++
 validation/expand/constant-union-flt2int.c    |  20 +++
 validation/expand/constant-union-int2flt.c    |  19 +++
 .../constant-union-size.c}                    |   7 +-
 validation/expand/cost-deref-nested.c         |  20 +++
 validation/expand/default-init-array.c        |  15 +++
 validation/expand/default-init-struct.c       |  22 ++++
 validation/expand/union-cast.c                |  27 ++++
 .../type-punning-flt2int.c}                   |   5 +-
 validation/memops/type-punning-int2flt.c      |  19 +++
 19 files changed, 404 insertions(+), 24 deletions(-)
 create mode 100644 validation/eval/addressable-complex.c
 create mode 100644 validation/eval/addressable-degen.c
 create mode 100644 validation/expand/constant-init-array.c
 create mode 100644 validation/expand/constant-init-nested-array.c
 create mode 100644 validation/expand/constant-init-nested-struct.c
 create mode 100644 validation/expand/constant-init-string.c
 create mode 100644 validation/expand/constant-static.c
 create mode 100644 validation/expand/constant-union-flt2int.c
 create mode 100644 validation/expand/constant-union-int2flt.c
 rename validation/{bug-expand-union0.c => expand/constant-union-size.c} (56%)
 create mode 100644 validation/expand/cost-deref-nested.c
 create mode 100644 validation/expand/default-init-array.c
 create mode 100644 validation/expand/default-init-struct.c
 create mode 100644 validation/expand/union-cast.c
 rename validation/{bug-expand-union1.c => memops/type-punning-flt2int.c} (63%)
 create mode 100644 validation/memops/type-punning-int2flt.c


base-commit: 9b2efc158c5c9700ffe355c59356879df7c9cc12