[PATCH] Adding support for NoDuplicate function attribute in CLang

Marcello Maggioni marcello at codeplay.com
Fri Nov 15 02:49:57 PST 2013


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.

I splitted the patch in two files. The "_code" file contains the part 
that adds the functionality to Clang and the "_tests" part contains the 
added tests.

Tell me if it is interesting to add this to mainline. If there is a need 
for corrections I'll be happy to make them.

Cheers,
Marcello

-- 
Marcello Maggioni

Compiler Engineer

  

Codeplay Software Ltd

45 York Place, Edinburgh, EH1 3HP

Tel: 0131 466 0503

Fax: 0131 557 6600

Website: http://www.codeplay.com

Twitter: https://twitter.com/@codeplaybiz

  

This email and any attachments may contain confidential and /or privileged information and  is for use  by the addressee only. If you are not the intended recipient, please notify Codeplay Software Ltd immediately and delete the message from your computer. You may not copy or forward it,or use or disclose its contents to any other person. Any views or other information in this message which do not relate to our business are not authorized by Codeplay software Ltd, nor does this message form part of any contract unless so stated.

As internet communications are capable of data corruption Codeplay Software Ltd does not accept any responsibility for any changes made to this message after it was sent. Please note that Codeplay Software Ltd does not accept any liability or responsibility for viruses and it is your responsibility to scan any attachments.

Company registered in England and Wales, number: 04567874

Registered office: 81 Linkfield Street, Redhill RH1 6BY

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_noduplicate_code.patch
Type: text/x-patch
Size: 2673 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131115/c2550eb1/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang_noduplicate_tests.patch
Type: text/x-patch
Size: 1733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131115/c2550eb1/attachment-0001.bin>


More information about the cfe-commits mailing list