This is an archive of the discontinued LLVM Phabricator instance.

[CoroElide] Remove fallback for frame layout determination
ClosedPublic

Authored by nikic on Mar 4 2022, 4:13 AM.

Details

Summary

Only determine the frame layout based on dereferenceable and align attributes, and remove the type-based fallback, which is incompatible with opaque pointers. The dereferenceable attribute is required, while the align attribute uses default alignment of 1 (commonly, align 1 attributes do not get placed, relying on default alignment).

The CoroSplit pass producing the resume function adds the necessary attributes in https://github.com/llvm/llvm-project/blob/7daed359111f6d151fef447f520f85ef1dabedf6/llvm/lib/Transforms/Coroutines/CoroSplit.cpp#L840, and they are checked in coro-debug.ll.

Diff Detail

Event Timeline

nikic created this revision.Mar 4 2022, 4:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 4:13 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.Mar 4 2022, 4:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2022, 4:13 AM
ChuanqiXu accepted this revision.Mar 6 2022, 6:19 PM

nit in the summary: the dereferenceable attribute is added in middle-end since *.resume function is generated in middle-end (CoroSplit pass). Maybe we need a test for it (check dereferenceable attribute for *.resume function)

This revision is now accepted and ready to land.Mar 6 2022, 6:19 PM
nikic edited the summary of this revision. (Show Details)Mar 7 2022, 2:20 AM

nit in the summary: the dereferenceable attribute is added in middle-end since *.resume function is generated in middle-end (CoroSplit pass). Maybe we need a test for it (check dereferenceable attribute for *.resume function)

Thanks for pointing that out, I've updated the description. Apparently there already is a test for the emitted attributes in coro-debug.ll and a couple other test files as well.

This revision was landed with ongoing or failed builds.Mar 7 2022, 2:23 AM
This revision was automatically updated to reflect the committed changes.