[PATCH] D24854: [SROA] Drop lifetime.start/end intrinsics when they block promotion.

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 18:15:24 PST 2016

chandlerc added inline comments.

Comment at: lib/Transforms/Scalar/SROA.cpp:2897-2901
+    bool IsWholeAlloca = NewBeginOffset == NewAllocaBeginOffset &&
+                         NewEndOffset == NewAllocaEndOffset;
+    if (!II.getFunction()->hasFnAttribute(Attribute::SanitizeAddress) &&
+        !IsWholeAlloca)
+      return true;
efriedma wrote:
> chandlerc wrote:
> > FWIW, I think this is sufficient to avoid regressing ASan while allowing promotion through partial lifetime markers. Is there something that breaks if you make this change and not the changes above? If so, I'd like to find a way to temporarily work around them as I think fully handling ASan + lifetime markers + promotable allocas is going to be a big project.
> The assertion on 2262 ("assert(CanSROA);") fails without the other changes.
> I can probably narrow the other checks so they only trigger on partial lifetime markers, if you think that would be an improvement.
OK, but making the changes above will I suspect have a much more dramatic impact on ASan.

I guess go with just always dropping partial alloca lifetime markers and leave a FIXME for the sanitizer folks to come in and re-work this.

I suspect that the sanitizer folks will need to accept the false-negatives here until they're able to move local scalar sanitizing to work in a non-shadow-memory way.



More information about the llvm-commits mailing list