Commit b54294e2 authored by Nick Desaulniers's avatar Nick Desaulniers
Browse files

[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 ...
parent 49429783
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment