[PATCH] D22842: Do not remove empty lifetime.start/lifetime.end ranges

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 15:10:47 PDT 2016


majnemer added a comment.

I am satisfied with this change from a code and test point of view but have no idea if this is correct behavior for the sanitizer.  Can somebody with more experience on that side of things comment?


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:2246-2248
@@ -2245,2 +2245,5 @@
   case Intrinsic::lifetime_start:
-    if (removeTriviallyEmptyRange(*II, Intrinsic::lifetime_start,
+    // Asan needs to poison memory to detect invalid access which is possible
+    // even for empty lifetime range.
+    if (!II->getFunction()->hasFnAttribute(Attribute::SanitizeAddress) &&
+        removeTriviallyEmptyRange(*II, Intrinsic::lifetime_start,
----------------
I'd prefer that this check get split out from the other.


https://reviews.llvm.org/D22842





More information about the llvm-commits mailing list