[LLVMdev] Clang question

Sebastian Redl sebastian.redl at getdesigned.at
Mon Mar 5 11:52:01 PST 2012


On 05.03.2012, at 19:53, Ryan Taylor wrote:

> Clang is inserting an llvm.memcpy function call into my program where it does not exist (the code never calls memcpy), is there a particular reason for this? It also looks like it's inserting two other artificial function calls, something to do with llvm.lifetime.start and llvm.lifetime.end, what are these functions and why are they being inserted artificially? 

llvm.lifetime.* are just markers that are used by the optimizer to reason about the code.
http://llvm.org/docs/LangRef.html#int_memorymarkers
They disappear without a trace when lowering to machine code.

The memcpy is just the way Clang does POD copying. It's up to the optimizers to decide whether to lower this to custom code or actually emit a call to memcpy.
http://llvm.org/docs/LangRef.html#int_memcpy

Sebastian



More information about the llvm-dev mailing list