<div dir="ltr"><div>Hi everybody,</div><div><br></div><div>back in November I made a patch that added the noduplicate attribute to Clang (original discussion here <a href="http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131118/093647.html">http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131118/093647.html</a> ). After passing multiple reviews in the end I went in holiday and the patch got lost and not committed :P</div>
<div><br></div><div>So here I try again to get this patch committed. The patch is needed by some OpenCL implementers , because it permits to mark functions as "Not duplicable" by optimization passes. (in the sense that function calls to the function cannot be duplicated).</div>
<div>Some functions require that optimization that convert code like this:</div><div><br></div><div>nodupfunc();</div><div>if (a < n) {</div><div>  foo();</div><div>} else {</div><div>  bar();</div><div>}</div><div><br>
</div><div>into this</div><div><br></div><div>if (a < n) {</div><div>  nodupfunc();</div><div>  foo();</div><div>} else {</div><div>  nodupfunc();</div><div>  bar();</div><div>}</div><div><br></div><div>do not consider the function call to "nodupfunc" for optimization. If the "nodupfunc" would have been marked as "NoDuplicate" the optimization wouldn't have performed the sinking and duplication of the function call. Typical examples of functions that requires this are some implementations of the OpenCL barrier() function.</div>
<div><br></div><div>That said, the patch is basically the same to the last one I posted back in november, updated to work with the latest clang code and I also added documentation for the new attribute as suggested by Richard Smith in one of the last messages.</div>
<div><br></div><div>The patch is split in two. One contains the code and one the tests for the new attribute.</div><div><br></div><div>If somebody can review it I'd appreciate :) I also don't have commit access, so I would need someone to commit it for me if it is fine.</div>
<div><br></div><div>Cheers,</div><div>Marcello</div></div>