1 // Test for PR59181. Tests that no conditional cleanup is created around await_suspend.
3 // REQUIRES: x86-registered-target
5 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o - -std=c++20 -disable-llvm-passes -fsanitize-address-use-after-scope | FileCheck %s
7 #include "Inputs/coroutine.h"
12 Task
get_return_object() {
16 std::suspend_never
initial_suspend() noexcept
{
20 std::suspend_never
final_suspend() noexcept
{
24 void return_value(Task t
) noexcept
{}
25 void unhandled_exception() noexcept
{}
27 auto await_transform(Task t
) {
29 auto await_ready() noexcept
{ return false;}
30 auto await_suspend(std::coroutine_handle
<> coro
) {
34 auto await_resume() noexcept
{
44 co_return cond
? Task
{ co_await Task
{}}: Task
{};
51 // CHECK: cleanup.cont:{{.*}}
52 // CHECK-NEXT: load i8
54 // CHECK-NEXT: store i1 false
56 // CHECK: await.suspend:{{.*}}
57 // CHECK-NOT: call void @llvm.lifetime
58 // CHECK: call void @llvm.coro.await.suspend.void(
59 // CHECK-NEXT: %{{[0-9]+}} = call i8 @llvm.coro.suspend(