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

Kostya Serebryany kcc at google.com
Sat Dec 1 09:44:37 PST 2012



================
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. 


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



More information about the llvm-commits mailing list