[LLVMdev] [RFC] "noclone" function attribute

James Molloy James.Molloy at arm.com
Sat Dec 1 09:50:17 PST 2012


> 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.

I like that idea, as long as we can find a way to implement it that isn't a hack in any way. The IR doesn't know about "barriers" (hence the concept of a noclone attribute), and we can't make the module verifier be stateful (knowing what noclone insts were around last time, comparing it with this time).

So I'm not sure how we'd do this without it being a hack in some way...
________________________________________
From: Krzysztof Parzyszek [kparzysz at codeaurora.org]
Sent: 01 December 2012 17:40
To: James Molloy
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] [RFC] "noclone" function attribute

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