================
@@ -1553,6 +1557,86 @@ static void EnterNewDeleteCleanup(CodeGenFunction &CGF,
const CXXNewExpr *E,
CGF.initFullExprCleanup();
}
+namespace {
+void PoisonTrivialField(CodeGenFunction &CGF, QualType const &Ty,
+ Address Dest) {
+ CharUnits Size = CGF.getContext().getTypeSizeInChars(Ty);
+ llvm::Value *SizeVal = CGF.CGM.getSize(Size);
+ llvm::Value *PoisonByte = llvm::PoisonValue::get(CGF.Builder.getInt8Ty());
+ CGF.Builder.CreateMemSet(Dest, PoisonByte, SizeVal,
Ty.isVolatileQualified());
----------------
dingxiangfei2009 wrote:
Hmm, I probably tested something wrong. Apparently indeed `memset` with `undef`
does not work reliably because they can get optimised away. It looks like
poisoning is the only way so far.
https://github.com/llvm/llvm-project/pull/188001
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits