StackLifetime: Remove asserts for multiple lifetime intrinsics.
authorPeter Collingbourne <peter@pcc.me.uk>
Wed, 18 Aug 2021 22:03:03 +0000 (15:03 -0700)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 19 Aug 2021 01:45:28 +0000 (18:45 -0700)
commit6f85225ef3791357f9b1aa097b575b0a2b0dff48
tree73f650960146cc9abba1d4c7f841292ad1208414
parent5fdaaf7fd8f35ac9c9de50a45b09e29c7b0d48c4
StackLifetime: Remove asserts for multiple lifetime intrinsics.

According to the langref, it is valid to have multiple consecutive
lifetime start or end intrinsics on the same object.

For llvm.lifetime.start:
"If ptr [...] is a stack object that is already alive, it simply
fills all bytes of the object with poison."

For llvm.lifetime.end:
"Calling llvm.lifetime.end on an already dead alloca is no-op."

However, we currently fail an assertion in such cases. I've observed
the assertion failure when the loop vectorization pass duplicates
the intrinsic.

We can conservatively handle these intrinsics by ignoring all but
the first one, which can be implemented by removing the assertions.

Differential Revision: https://reviews.llvm.org/D108337
llvm/lib/Analysis/StackLifetime.cpp
llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll