[PATCH] D88236: [PR47636] Fix tryEmitPrivate to handle non-constantarraytypes

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 12:27:51 PDT 2020


erichkeane added a comment.

Ok then, I'll take a look to see what it would take to make the MaterializeTemporaryExpr be created with the complete type here instead.  Thanks!



================
Comment at: clang/lib/CodeGen/CGExprConstant.cpp:2148
+        CommonElementType == nullptr && !NumInitElts) {
       const ArrayType *AT = CGM.getContext().getAsArrayType(DestType);
       CommonElementType = CGM.getTypes().ConvertType(AT->getElementType());
----------------
rsmith wrote:
> 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.
I'll submit a patch to remove this branch then, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88236/new/

https://reviews.llvm.org/D88236



More information about the cfe-commits mailing list