This is an archive of the discontinued LLVM Phabricator instance.

[Coroutines] createStructType/createPointerType takes alignment in bits but receives bytes
ClosedPublic

Authored by gchatelet on Nov 28 2022, 2:58 AM.

Details

Summary

This has been found while trying to remove the last few places relying on unsigned to convey alignment operations.
This seems to be untested.

Diff Detail

Event Timeline

gchatelet created this revision.Nov 28 2022, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 2:58 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
gchatelet requested review of this revision.Nov 28 2022, 2:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2022, 2:58 AM
gchatelet updated this revision to Diff 478193.Nov 28 2022, 4:46 AM
  • Fix same issue a few lines above
  • Format lines
gchatelet retitled this revision from [Coroutines] createStructType takes alignment in bits but receives bytes to [Coroutines] createStructType/createPointerType takes alignment in bits but receives bytes.Nov 28 2022, 4:56 AM

@ChuanqiXu perhaps you could help with a test case for this?
(@gchatelet you could probably find a test case for this by deliberately introducing a patch that uses the wrong size, or maybe makes something other than a pointer type? (like a const type instead?) to find a test case that fails, add extra checking for the alignment and then see if that can verify your fix?)

Thanks for reporting this! You can test this change in coro-debug-coro-frame.ll. You can print the original output then compare it with the output after applying this patch. Then you can fulfill the align field in the CHECKs. Remind me if you need me to precommit it for you.

I've submitted rG543962f024b3068894a8a6ec2d2f0fccea6f5f2d that integrates the bad behavior in the test. I'll rebase this patch to demonstrate the correction.

gchatelet updated this revision to Diff 478522.Nov 29 2022, 4:31 AM
  • Fix same issue a few lines above
  • Format lines
  • Fix test submitted in 543962f024b3
ChuanqiXu accepted this revision.Nov 29 2022, 7:56 AM

LGTM. Thanks!

This revision is now accepted and ready to land.Nov 29 2022, 7:56 AM
This revision was landed with ongoing or failed builds.Nov 29 2022, 8:05 AM
This revision was automatically updated to reflect the committed changes.