[PATCH] D76096: [clang] allow const structs/unions/arrays to be constant expressions for C

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 15:42:15 PDT 2023


efriedma added a comment.

Hmm, that kind of construct could run into issues with large global variables.  If we "inline" a bunch of large global constants into initializers for arrays, we could significantly increase codesize.  Not sure how likely that is in practice.  We could maybe consider teaching CGExprConstant to abort in such cases (not sure if it currently tracks whether we're initializing a global variable or a local.)  Not sure what the heuristics for that would look like.

Thinking about it a bit more, maybe we should just observe overall compiler behavior.  If the compile-time and codesize for the Linux kernel (and maybe also the llvm test-suite) is mostly unchanged, we're probably fine.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76096/new/

https://reviews.llvm.org/D76096



More information about the cfe-commits mailing list