[PATCH] D25334: Implement __stosb intrinsic as a volatile memset

Albert Gutowski via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 10 12:11:17 PDT 2016


agutowski marked 2 inline comments as done.
agutowski added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:7610
+    Value *SizeVal = EmitScalarExpr(E->getArg(2));
+    EmitNonNullArgCheck(RValue::get(Dest.getPointer()), E->getArg(0)->getType(),
+                        E->getArg(0)->getExprLoc(), FD, 0);
----------------
hans wrote:
> Hmm, does the __stosb intrinsic require Dest to be non-null (e.g. would Dest=NULL, Count=0 be OK?) I'm not even sure what llvm's memset requires actually.
I can't find any guarantee that memset accepts Dest=NULL and Count=0. So I guess we can either add a branch here, checking if the pointer is NULL (and that Count=0?) or assume that memset won't do anything strange. I vote for the latter (the current code does it).


https://reviews.llvm.org/D25334





More information about the cfe-commits mailing list