[llvm-commits] New function attr: ExecuteBarrier to prevent llvm from duplicating barriers

Chris Lattner clattner at apple.com
Wed Mar 21 21:03:47 PDT 2012


On Feb 12, 2012, at 1:11 PM, Rotem, Nadav wrote:

> Hi,
>  
> Last year we talked about the problem of LLVM duplicating function calls that are considered 'barrier' in data-parallel languages, such as OpenCL.  I implemented Eli's proposal[1] to add a new function attribute (executebarrier) which prevents the duplication of barriers in a number of LLVM optimizations.  I still need to handle the loop unswitch pass and review a few other passes.

Hi Nadav,

Sorry for the delay getting to this.  IIUC, the key functionality that you're looking for here is to prevent the optimizing from duplicating certain calls.  If that's what you're looking for, I'd propose something like this:

1. New function attribute, "noduplicate" or something like that.
2. Update the code metrics inlining cost calculation stuff to treat calls to functions with this new attribute as not duplicatable (similar to noinline for the inliner).
3. Update the optimizer to use the code metrics in all places where it is duplicating pieces of code.

#3 is really the clincher for me.  I really don't want random checks for this new attribute scattered throughout the optimizer, and having the optimizer use common code to determine duplication cost is general goodness anyway.

-Chris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120321/9e354b6e/attachment.html>


More information about the llvm-commits mailing list