This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] Directly remove unnecessary lifetime intrinsics
ClosedPublic

Authored by nikic on Apr 13 2023, 8:38 AM.

Details

Summary

The insertSpills() code will currently skip lifetime intrinsic users when replacing the alloca with a frame reference. Rather than leaving behind the dead lifetime intrinsics working on the old alloca, directly remove them. This makes sure the alloca can be dropped as well.

I noticed this as a regression when converting tests to opaque pointers. Without opaque pointers, this code didn't really do anything, because there would usually be a bitcast in between. The lifetimes would get rewritten to the frame pointer. With opaque pointers, this code now triggers and leaves behind users of the old allocas.

I'm also open to just dropping this check -- I'm trusting the comment that dropping the lifetime intrinsics is indeed what we want.

Diff Detail

Event Timeline

nikic created this revision.Apr 13 2023, 8:38 AM
nikic requested review of this revision.Apr 13 2023, 8:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 8:38 AM
ChuanqiXu accepted this revision.Apr 13 2023, 7:11 PM

LGTM. Thanks!

This revision is now accepted and ready to land.Apr 13 2023, 7:11 PM
This revision was landed with ongoing or failed builds.Apr 14 2023, 1:22 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2023, 1:22 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript