[LLVMdev] [RFC] "noclone" function attribute

Krzysztof Parzyszek kparzysz at codeaurora.org
Sat Dec 1 09:40:55 PST 2012


On 12/1/2012 11:25 AM, James Molloy wrote:
>> Maybe a similar interface could be added to Instruction, and an
>> instruction would declare itself unsafe to clone if it was a call to a
>> function with the attribute that you are proposing.
>
> I experimented with something similar to this, where Instruction::clone ensured it wasn't "noclone" - if it was, it asserted. But that broke the use-case of cloning whole functions.

I guess the problem would be when the compiler wants to clone the 
instruction with the plan of deleting the original later.  In such a 
scenario there could be temporarily (and legitimately) multiple calls to 
the barrier.  An example could be inlining of the only call to a static 
foo, which contains a call to "barrier".

Checking of issues with split barriers could be done by the module 
verifier.  We would need to make all the calls to barrier unique at the 
beginning (for example, by passing a fake, compiler-generated identifier 
as an argument).  The module verifier could check that in a given module 
there are no multiple calls to "barrier" that have the same identifier.

-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list