An async suspend models the split between two partial async functions.
llvm.swift.async.context.addr  will have a different value in the two
partial functions so it is not correct to generally CSE the instruction.
rdar://97336162
| Paths 
 |  Differential  D130201  
llvm.swift.async.context.addr cannot be modeled as NoMem because we don't want it to be cse'd accross async suspends ClosedPublic Authored by aschwaighofer on Jul 20 2022, 2:01 PM. 
Details Summary An async suspend models the split between two partial async functions. rdar://97336162 
Diff Detail 
 Event Timeline
 This revision is now accepted and ready to land.Jul 22 2022, 9:51 AM This revision was landed with ongoing or failed builds.Jul 22 2022, 11:51 AM Closed by commit rG58e6ee0e1f16: llvm.swift.async.context.addr cannot be modeled as NoMem because we don't want… (authored by aschwaighofer).  ·  Explain Why This revision was automatically updated to reflect the committed changes. 
Revision Contents 
 
Diff 446920 llvm/include/llvm/IR/Intrinsics.td
 llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp
 llvm/lib/Target/X86/X86ISelLowering.cpp
 
 llvm/test/Transforms/Coroutines/coro-async-no-cse-swift-async-context-addr.ll
 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Hmm. We could be a little less conservative and mark the intrinsic as IntrReadMem. The suspend intrinsic does write to memory so the required ordering would be maintained.
In practice, I don't think it matters much because the way we use this intrinsic is to store to its result: