r177819 - Make clang to mark static stack allocations with lifetime markers to enable a more aggressive stack coloring.

Alexey Samsonov samsonov at google.com
Tue Mar 26 07:57:39 PDT 2013


On Tue, Mar 26, 2013 at 1:01 AM, Eric Christopher <echristo at gmail.com>wrote:

>
>
>
> On Mon, Mar 25, 2013 at 12:42 PM, Nadav Rotem <nrotem at apple.com> wrote:
>
>>
>> On Mar 25, 2013, at 12:23 PM, Alexey Samsonov <samsonov at google.com>
>> wrote:
>>
>> Cool you guys are working on it! I have a raw local patch that does the
>> same (emits llvm.lifetime start/end intrinsics), and
>> I hope to provide some feedback tomorrow, when I look at this commit in
>> more details. Some of my concerns:
>> 1) Rafael mentioned a thread where I asked about llvm.lifetime intrinsics
>> semantics and behavior - you may be
>> interested in it. I think we may resurrect it and clarify their semantics.
>>
>> 2) I'm afraid that immediate enabling of stack coloring may break things
>> - I've seen that similar gcc option
>> had to be disabled on some codebases because of the bugs in the code
>> where a local variable was used after
>> it went out of scope.
>>
>>
>> The Stack-Coloring pass detects undefined behavior such as the one that
>> you mentioned and aborts the optimization. It has a command line flag that
>> allows it to assert and crash on debug builds in order to debug the
>> compiler itself.
>>
>
What about the following (real-life) case?

void foo() {
  int x = 42;
  ReadPointerInADifferentThread(&x);
}



>
>>
> Are you talking about the bits in removeInvalidSlotRanges
> (ProtectFromEscapedAllocas)? That code appears to be disabled by default?
>
> -eric
>
>
>


-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130326/1662e135/attachment.html>


More information about the cfe-commits mailing list