[PATCH] D88236: [PR47636] Fix tryEmitPrivate to handle non-constantarraytypes
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 24 12:23:55 PDT 2020
rsmith added inline comments.
================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:2148
+ CommonElementType == nullptr && !NumInitElts) {
const ArrayType *AT = CGM.getContext().getAsArrayType(DestType);
CommonElementType = CGM.getTypes().ConvertType(AT->getElementType());
----------------
rjmccall wrote:
> `AT` is now just `ArrayTy`, and I think you can just check `!Filler && !NumInitElts`.
`Filler` is null if and only if `NumElements == NumInitElts`, and `NumInitElts <= NumElements`, so this condition reduces to `if (!NumElements)`. `EmitArrayConstant` responds to that case by creating a `ConstantAggregateZero` of its destination type. So it seems to me that we probably don't need this special case at all.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D88236/new/
https://reviews.llvm.org/D88236
More information about the cfe-commits
mailing list