[LLVMdev] How to make sure llvm.memset intrinsic is not lowered into memset() call?
samsonov at google.com
Mon Sep 30 07:40:01 PDT 2013
There are cases when we want our instrumentation passes for Sanitizer tools
to insert llvm.memset.* calls (basically, we want to mark certain region of
user memory as (un)addressable by writing magic values for "shadow" of that
memory region). llvm.memset are convenient:
(1) we don't have to manually emit all these n-byte stores in a cycle.
(2) llvm.memset can be inlined as a platform-specific fast instructions
But there will be a problem if llvm.memset is lowered into a regular
memset() call: sanitizer runtime libraries intercept all memset() calls and
treat them as function calls made by user, in particular checking that its
arguments point to an addressable "user" memory, not some
sanitizer-specific memory regions.
Can you suggest a way to ensure llvm.memset() is not transformed into
memset function()? This intrinsic has <isvolatile> argument, which limits
possible optimization of this call, does it make sense to add yet another
argument, that would forbid transforming it into function calls?
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev