[PATCH] D76096: [clang] allow const structs to be constant expressions in initializer lists
Nick Desaulniers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 13 16:13:09 PDT 2020
nickdesaulniers added a comment.
In D76096#1922239 <https://reviews.llvm.org/D76096#1922239>, @rsmith wrote:
> it's substantially more efficient for CodeGen to walk the AST representation (the `InitListExpr`) and directly generate an IR constant than it is to create an `APValue` representation of the array. (`APValue` is not especially space-efficient, and the extra copying and data shuffling can be quite slow.)
Isn't that what my patch is doing? (Codegen walking the AST/`InitListExpr`, generating `Constant`s)?
Uploading what I have; handling arrays is trickier than structs; the index and the base both end up having complex subtrees to fetch values from. As much fun as it is to build a compile time evaluator, it sounds like I should stop pursing `CGExprConstant` visitors in favor of `ExprConstant`? (I guess it's not clear to me whether @rsmith is in agreement with @eli.friedman on whether we want to be more aggressive in compile time evaluation or not).
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