This is an archive of the discontinued LLVM Phabricator instance.

[clang][pr55896]:co_yield/co_await thread-safety
ClosedPublic

Authored by urnathan on Jun 7 2022, 10:41 AM.

Details

Summary

co_await and co_yield are represented by (classes derived from)
CoroutineSuspendExpr. That has a number of child nodes, not all of
which are used for code-generation. In particular the operand is
represented multiple times, and, like the problem with co_return
(55406) it must only be emitted in the CFG exactly once. The operand
also appears inside OpaqueValueExprs, but that's ok.

This adds a visitor for SuspendExprs to emit the required children in
the correct order. Note that this CFG is pre-coro xform. We don't
have initial or final suspend points.

Diff Detail

Event Timeline

urnathan created this revision.Jun 7 2022, 10:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 7 2022, 10:41 AM
urnathan requested review of this revision.Jun 7 2022, 10:41 AM
bruno accepted this revision.Jun 8 2022, 3:44 PM

LGTM, thanks for the detailed explanation/comments. One minor nitpick inline.

clang/lib/Analysis/CFG.cpp
3164

Remove the extra spaces after "."

This revision is now accepted and ready to land.Jun 8 2022, 3:44 PM
urnathan marked an inline comment as done.Jun 9 2022, 4:05 AM
urnathan added inline comments.
clang/lib/Analysis/CFG.cpp
3164

It's gonna take my fingers a long time to get that right -- particularly working in multiple code bases :)

This revision was automatically updated to reflect the committed changes.
urnathan marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2022, 4:42 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript