[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-25 Thread Nick Desaulniers via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rG15a484bf6990: [clang][ConstExprEmitter] handle IntegerLiterals (authored by nickdesaulniers). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156154/new/

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. In D156154#4529907 , @nickdesaulniers wrote: > > Should speed up "is the below expression a constant expression?" > >> What kind of code do this effect? > > > > int y = 2; > ^ is 2 a constant expression? Nice!

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D156154#4529889 , @shafik wrote: > What practical effects will this have? As of D151587 ... From the commit message `Improves the ability of ConstExprEmitter to evaluate constants.`

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik added a comment. What practical effects will this have? What kind of code do this effect? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156154/new/ https://reviews.llvm.org/D156154 ___

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma accepted this revision. efriedma added a comment. This revision is now accepted and ready to land. That said, skipping all those abstraction layers for the simplest cases is probably worth it; LGTM. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. We don't completely fall back if a subexpression fails to evaluate. EmitArrayInitialization etc. don't recursively visit; they use tryEmitPrivateForMemory, so we can fallback for subexpressions. (tryEmitPrivateForMemory can still fail for certain constructs, like

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals

2023-07-24 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers updated this revision to Diff 543665. nickdesaulniers retitled this revision from "[clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts" to "[clang][ConstExprEmitter] handle IntegerLiterals". nickdesaulniers added a comment. - remove mention of IntegralCasts from

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts

2023-07-24 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers updated this revision to Diff 543662. nickdesaulniers marked an inline comment as done. nickdesaulniers added a comment. - put back the IntegralCast, for now Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156154/new/

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts

2023-07-24 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D156154#4529265 , @efriedma wrote: > As a practical matter, I'm not sure this helps much; ExprConstant should be > reasonably fast for simple integers. The performance issues only really show > for structs/arrays.

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts

2023-07-24 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. As a practical matter, I'm not sure this helps much; ExprConstant should be reasonably fast for simple integers. The performance issues only really show for structs/arrays. But maybe it helps a little to handle a few of the most common integer expressions.

[PATCH] D156154: [clang][ConstExprEmitter] handle IntegerLiterals and IntegralCasts

2023-07-24 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers created this revision. Herald added a project: All. nickdesaulniers requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Improves the ability of ConstExprEmitter to evaluate constants. Found by adding asserts to