When I playing with Coroutines, I found that it is possible to generate following IR:
%struct = alloca ... %sub.element = getelementptr %struct, i64 0, i64 index ; index is not zero lifetime.marker.start(%sub.element) % use of %sub.element lifetime.marker.end(%sub.element) store %struct to xxx ; %struct is escaping! <suspend points>
Then the AllocaUseVisitor would collect the lifetime marker for sub.element and treat it as the lifetime markers of the alloca! So it judges that the alloca could be put on the stack instead of the frame by judging the lifetime markers only.
The root cause for the bug is that AllocaUseVisitor collects wrong lifetime markers.
This patch fixes this.
Test Plan: check-all