[LLVMdev] [RFC] "noclone" function attribute

Krzysztof Parzyszek kparzysz at codeaurora.org
Sat Dec 1 08:22:29 PST 2012


On 12/1/2012 10:02 AM, James Molloy wrote:
>
> This means that cloning whole functions (CloneFunction and CloneFunctionInto) will still work [...].

Unfortunately, it won't work.

Assume all threads call foo:

foo() {
   ...
   bar(i)
   ...
}

bar(int i) {
   ...
   barrier();
   ...
}


Now, suppose that we have discovered that bar(0) can be greatly 
optimized and generate a call to the specialized version, bar_0:

foo() {
   ...
   if (i == 0) bar_0();
   else        bar(i);
   ...
}


And now we have multiple threads that no longer have a common barrier.


-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