================
@@ -1209,8 +1301,21 @@ static void emitStoresForConstant(CodeGenModule &CGM, 
const VarDecl &D,
   // If the initializer is all or mostly the same, codegen with bzero / memset
   // then do a few stores afterward.
   if (shouldUseBZeroPlusStoresToInitialize(constant, ConstantSize)) {
-    auto *I = Builder.CreateMemSet(Loc, llvm::ConstantInt::get(CGM.Int8Ty, 0),
-                                   SizeVal, isVolatile);
+    size_t LeadingNonNullBytes =
+        CountLeadingNonNullBytes(CGM.getDataLayout(), constant);
----------------
efriedma-quic wrote:

I don't like the way this duplicates the logic.  You aren't really trying to 
count bytes that are "non-null"; you're trying to find the offset of the first 
byte that isn't overwritten by emitStoresForInitAfterBZero.  The best place to 
compute that is emitStoresForInitAfterBZero itself.

https://github.com/llvm/llvm-project/pull/79502
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to