================ @@ -592,10 +590,14 @@ void AggExprEmitter::EmitArrayInit(Address DestPtr, llvm::ArrayType *AType, // observed to be unnecessary. if (endOfInit.isValid()) Builder.CreateStore(element, endOfInit); } - - LValue elementLV = CGF.MakeAddrLValue( - Address(element, llvmElementType, elementAlign), elementType); + Address address = Address(element, llvmElementType, elementAlign); + LValue elementLV = CGF.MakeAddrLValue(address, elementType); EmitInitializationToLValue(Args[i], elementLV); + // Schedule to emit element cleanup if we see a branch in the array + // initialisation expression. + if (CGF.needsBranchCleanup(dtorKind)) + CGF.pushDestroy(BranchInExprCleanup, address, elementType, ---------------- usx95 wrote:
Can you please tell me how to verify that mem2reg will clear these stores. If we can use this cleanup as-is, then we should be able to reuse the EHCleanups without introducing another cleanup stack (as also pointed out by @jyknight). It is important that we do not introduce these stores with exceptions disabled. But from the looks of it, it should be a easy optimisation pass as the store would never be read in normal circumstances. This is the only blocker in the reusing EH-only cleanups which . https://github.com/llvm/llvm-project/pull/80698 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits