We need __stosb to be an intrinsic, because SecureZeroMemory function uses it without including intrin.h. Implementing it as a volatile memset is not consistent with MSDN specification, but it gives us target-independent IR while keeping the most important properties of __stosb.
Details
Diff Detail
- Build Status
Buildable 453 Build 453: arc lint + arc unit
Event Timeline
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
7604 | Nit: I'd suggest capital w for "We" and ending the sentence with a period. I see many other comments in the file don't do this, but we can at least set a good example :-) | |
7610 | 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. | |
7613 | Why is it returning Dest here, and not the result of Builder.CreateMemSet? |
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
7613 | My mistake (that's what memset returns), thanks! |
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
7610 | 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). |
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
7610 | I think the approach you've taken here is fine, we shouldn't need a branch. |
lib/CodeGen/CGBuiltin.cpp | ||
---|---|---|
7777 | I think we should manually force the alignment to 1 instead of trying to be clever. |
I think we should manually force the alignment to 1 instead of trying to be clever.