================ @@ -1759,20 +1759,29 @@ void CodeGenFunction::emitZeroOrPatternForAutoVarInit(QualType type, const VarDecl &D, Address Loc) { auto trivialAutoVarInit = getContext().getLangOpts().getTrivialAutoVarInit(); + auto trivialAutoVarInitSizeBound = + getContext().getLangOpts().TrivialAutoVarInitSizeBound; CharUnits Size = getContext().getTypeSizeInChars(type); bool isVolatile = type.isVolatileQualified(); if (!Size.isZero()) { + auto allocSize = CGM.getDataLayout().getTypeAllocSize(Loc.getElementType()); ---------------- haopliu wrote:
The problem of `emitStoresForConstant` is that it may split struct/array variables to a handful of stores, which would mess up the size filtering (e.g., difficult to debug). What do you think? > what if we have a large array of structs with a few uninitialized fields. Initializing the rest will cost us anyway about the same. (Correct me if I'm wrong) While emitting the auto-init, clang has no idea how each filed/element is initialized. It's difficult to distinguish these two cases in `CGDecl.cpp`: - A large array of structs with all fields uninitialized. - A large array of structs with a few field uninitialized. https://github.com/llvm/llvm-project/pull/74777 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits