[PATCH] Adding support for NoDuplicate function attribute in CLang

David Tweed david.tweed at gmail.com
Wed Nov 20 05:54:16 PST 2013


On Wed, Nov 20, 2013 at 1:22 PM, Aaron Ballman <aaron at aaronballman.com>wrote:

> On Fri, Nov 15, 2013 at 5:49 AM, Marcello Maggioni
> <marcello at codeplay.com> wrote:
> > Hi all,
> >
> > I made a patch that adds the capability of defining the NoDuplicate
> > attribute for a function using both the GNU and CXX11 attribute syntaxes
> > like in:
> >
> > __attribute__((noduplicate))
> > [[noduplicate]]
> >
> > I also added tests to test out the new addition.
> > The NoDuplicate attribute is useful to avoid the application of compiler
> > optimizations like Loop Unswitching to code containing function calls
> that
> > implement functionality like barriers in OpenCL. These functions could
> fail
> > if such an optimization is applied on the code that calls them.
>
> How is this different from the optnone attribute that was recently
> added? The attribute name here doesn't really convey much meaning
> based on this description, so perhaps there is a better name for it?
>

Note that in the OpenCL use case, the name precisely describes the intent:
you can
move barrier calls around, inline them, etc, if you can show that the
semantics of
OpenCL code is the same but (on some particular architectures) you aren't
allowed to
duplicate a given barrier call (due to implementation restrictions) even if
otherwise
the semantics was ok. This relates to the LLVM function attribute named
noduplicate
(as visible in the patch, obviously)

-- 
cheers, dave tweed__________________________
high-performance computing and machine vision expert: david.tweed at gmail.com
"while having code so boring anyone can maintain it, use Python." --
attempted insult seen on slashdot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131120/0353d489/attachment.html>


More information about the cfe-commits mailing list