diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2023-07-24 13:40:14 -0700 |
---|---|---|
committer | Nick Desaulniers <ndesaulniers@google.com> | 2023-07-24 13:50:45 -0700 |
commit | b54294e2c9596088aaf557b221bcf471745864bc (patch) | |
tree | 1cd73f93af8d179de552c9960a883b60bf35f2fb /llvm/tools/llvm-objdump/llvm-objdump.cpp | |
parent | 49429783b0f4fb9c6f2a25746fe90072e19eb38c (diff) | |
download | llvm-b54294e2c9596088aaf557b221bcf471745864bc.zip llvm-b54294e2c9596088aaf557b221bcf471745864bc.tar.gz llvm-b54294e2c9596088aaf557b221bcf471745864bc.tar.bz2 |
[clang][ConstantEmitter] have tryEmitPrivate[ForVarInit] try ConstExprEmitter fast-path first
As suggested by @efriedma in:
https://reviews.llvm.org/D76096#4370369
This should speed up evaluating whether an expression is constant or
not, but due to the complexity of these two different implementations,
we may start getting different answers for edge cases for which we do
not yet have test cases in-tree (or perhaps even performance regressions
for some cases). As such, contributors have carte blanche to revert if
necessary.
For additional historical context about ExprConstant vs CGExprConstant,
here's snippets from a private conversation on discord:
ndesaulniers:
why do we have clang/lib/AST/ExprConstant.cpp and
clang/lib/CodeGen/CGExprConstant.cpp? Does clang constant fold during
ast walking/creation AND during LLVM codegen?
efriedma:
originally, clang needed to handle two things: integer constant
expressions (the "5" in "int x[5];"), and constant global initializers
(the "5" in "int x = 5;"). pre-C++11, the two could be handled mostly
separately; so we had the code for integer constants in AST/, and the
code for globals in CodeGen/. C++11 constexpr sort of destroyed that
separation, though. so now we do both kinds of constant evaluation on
the AST, then CGExprConstant translates the result of that evaluation
to LLVM IR. but we kept around some bits of the old cgexprconstant to
avoid performance/memory usage regressions on large arrays.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D151587
Diffstat (limited to 'llvm/tools/llvm-objdump/llvm-objdump.cpp')
0 files changed, 0 insertions, 0 deletions