[llvm-commits] [PATCH] [ASan] fix lifetime intrinsics handling

Alexey Samsonov samsonov at google.com
Thu Dec 27 00:32:48 PST 2012



================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:328
@@ +327,3 @@
+
+  // Used to store allocas which values come from.
+  typedef DenseMap<Value*, AllocaInst*> AllocaForValueMapTy;
----------------
Kostya Serebryany wrote:
> Maybe like this?
> Maps Value to an AllocaInst from which the Value is originated
Done

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1238
@@ +1237,3 @@
+  bool HavePoisonedAllocas = false;
+  if (ASan.CheckLifetime) {
+    for (size_t i = 0, n = AllocaPoisonCallVec.size(); i < n; i++) {
----------------
Kostya Serebryany wrote:
> do you need this if? 
> If it's false, the vector will be empty. 
Done

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:329
@@ +328,3 @@
+  // Used to store allocas which values come from.
+  typedef DenseMap<Value*, AllocaInst*> AllocaForValueMapTy;
+  AllocaForValueMapTy AllocaForValue;
----------------
Kostya Serebryany wrote:
> no need for this typedef anymore
See below

================
Comment at: lib/Transforms/Instrumentation/AddressSanitizer.cpp:1343
@@ +1342,3 @@
+  // infinite recursion if the value references itself.
+  AllocaForValue[V] = 0;
+  AllocaInst *Res = 0;
----------------
Kostya Serebryany wrote:
> Res = AllocaForValue[V];  // Creates a 0 value if there is not such element.
> if (Res)
>   return Res;
This is not equivalent: we should also do an early return if the map contains "0" as the value for key V.


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



More information about the llvm-commits mailing list