[llvm-commits] [PATCH] AddressSanitizer: handle llvm.lifetime intrinsics (LLVM part)

Alexey Samsonov samsonov at google.com
Mon Dec 3 17:36:31 PST 2012


On Sat, Dec 1, 2012 at 9:44 AM, Kostya Serebryany <kcc at google.com> wrote:

>
>
> ================
> Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1121
> @@ +1120,3 @@
> +  if (AllocaType == Int8PtrTy)
> +    Res |= handleValueLifetime(Alloca);
> +  for (Value::use_iterator UI = Alloca->use_begin(), UE =
> Alloca->use_end();
> ----------------
> Alexey Samsonov wrote:
> > Kostya Serebryany wrote:
> > > This function where you call handleValueLifetime multiple times is
> hard to understand. I'd really prefer to iterate over all
> llvm.lifetime.start
> > > markers instead.
> > I've added comment to the original function. I think that iterating over
> lifetime markers wouldn't be easier: you'll have to store the set of
> allocas we merge (ok), but when you take a lifetime marker, you should
> check if its argument was in fact casted from the one of these allocas...
> >> you'll have to store the set of allocas we merge
> Actually, no.
>
> the instruction should look something like
>   llvm.lifetime.start((i8*)(grand_alloca+offset)),
> so you just need to check for that pattern.
>
> I think this will make the code easier to understand and a bit more robust
> (less chance to miss some of the llvm.lifetime.start).
>
> Still, if you feel strong about your solution, please commit now.
> It should be ok too.
>
> Submitted this as r169200. Will go to Clang part / more intensive testing
/ bootstrapping soon.


>
> http://llvm-reviews.chandlerc.com/D140


-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121203/3d222731/attachment.html>


More information about the llvm-commits mailing list