This is an archive of the discontinued LLVM Phabricator instance.

Handle lifetime intrinsics when sinking calls with dead writes
AbandonedPublic

Authored by reames on Jan 5 2022, 11:49 AM.

Details

Reviewers
nikic
anna
Summary

Follow up to D116200, specifically adding the lifetime case.

I'm not terribly happy with this patch, and hoping someone else has a better idea. The tricky case is when the call is writeonly. If it read, we could rely on the block scan done for the read case just below, but we end up having to duplicate a bunch of logic just to handle the writeonly case.

A couple of thoughts:

  1. Maybe we just shouldn't handle this case? e.g. allow readwrite calls to be sunk with lifetimes, but bailtout with a comment explaining why?
  2. Maybe comesBefore (and potentially numbering the source block) isn't that bad afterall?
  3. Maybe we introduce a ScanBlockSuffix flag, reuse the existing code, and accept the false negative of their being unrelated writes in the block suffix? (Given this only causes additional false negatives for writeonly, maybe that's okay?)

Diff Detail

Unit TestsFailed

Event Timeline

reames created this revision.Jan 5 2022, 11:49 AM
reames requested review of this revision.Jan 5 2022, 11:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2022, 11:49 AM
reames abandoned this revision.Feb 3 2022, 8:00 AM

No review progress, and not currently blocking anything for me.