[all-commits] [llvm/llvm-project] 34415f: [Clang][LLVM][Coroutines] Prevent __coro_gro from ...

Bruno Cardoso Lopes via All-commits all-commits at lists.llvm.org
Thu Sep 21 22:52:18 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 34415fd611e2d92da570bc4adf931a6410fb406e
  Author: Bruno Cardoso Lopes <bcardosolopes at users.noreply.github.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M clang/lib/CodeGen/CGCoroutine.cpp
    M clang/test/CodeGenCoroutines/coro-gro.cpp
    M llvm/docs/Coroutines.rst
    M llvm/include/llvm/IR/FixedMetadataKinds.def
    M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
    A llvm/test/Transforms/Coroutines/coro-alloca-outside-frame.ll

  Log Message:
  [Clang][LLVM][Coroutines] Prevent __coro_gro from outliving __promise (#66706)

When dealing with short-circuiting coroutines (e.g. expected), the
deferred calls that resolve the get_return_object are currently being
emitted after we delete the coroutine frame.

This was caught by ASAN when using optimizations -O1 and above:
optimizations after inlining would place the __coro_gro in the heap, and
subsequent delete of the coroframe followed by the conversion -> BOOM.

This patch forbids the GRO to be placed in the coroutine frame, by
adding a new metadata node that can be attached to `alloca`

Fix #49843

More information about the All-commits mailing list