Support voliatile memory intrinsics #1253
Yawning
started this conversation in
Ideas/Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I need a way to zero memory that will not be removed by the various forms of optimization.
Describe the solution you'd like
The
llvm.memcpy
/llvm.memmove
/llvm.memset
intrinsics calls have aisvolatile
parameter that is currently not exposed. To the best of my knowledge, implementing a call analogous tomemset_s
(C11 Annex K)/SecureZeroMemory
(Windows) can be done on LLVM by using a volatilellvm.memset
followed by a sequentially consistent memory fence (atomic_fence()
fromcore:intrinsics
).For my purposes being able to do a volatile
llvm.memset
is sufficient, but others may want volatile versions of the other functions.Additional context
Dead Store Elimination (Still) Considered Harmful gives an overview of the problem space and common techniques (some which are flawed) to address this problem.
The zeroize Rust crate uses the volatile memeset + barrier approach.
Beta Was this translation helpful? Give feedback.
All reactions