[LLVMdev] Clang question

Christoph Erhardt christoph at sicherha.de
Mon Mar 5 11:51:40 PST 2012


Hi Ryan,

the compiler is free to insert implicit calls to memcpy(), for instance
for assignments from one struct/class variable to another. The same goes
for memset(), which may be inserted implicitly for the initialization of
local structs or arrays.

The good news is that the backend normally optimizes these calls away
where possible, replacing them with simple moves - at least as long as
the number of bytes to copy does not exceed a certain threshold.

As for the llvm.lifetime intrinsics, take a look at the documentation:
http://llvm.org/docs/LangRef.html#int_memorymarkers
If I'm not mistaken, these calls seem to be used to mark the lifespan of
a stack-allocated object.

Regards,
Christoph



More information about the llvm-dev mailing list