1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s
2 
3 #include "Inputs/coroutine.h"
4 
5 using namespace std::experimental;
6 
7 struct coro {
8   struct promise_type {
9     coro get_return_object();
10     suspend_always initial_suspend();
11     suspend_never final_suspend() noexcept;
12     void return_void();
13     static void unhandled_exception();
14   };
15 };
16 
f(int)17 extern "C" coro f(int) { co_return; }
18 // Verify that cleanup.dest.slot is eliminated in a coroutine.
19 // CHECK-LABEL: f(
20 // CHECK: call void @_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(
21 // CHECK: %[[CLEANUP_DEST:.+]] = phi i32 [ 0, %{{.+}} ], [ 2, %{{.+}} ], [ 2, %{{.+}} ]
22 // CHECK: call i8* @llvm.coro.free(
23 // CHECK: switch i32 %cleanup.dest.slot.0, label %{{.+}} [
24 // CHECK-NEXT: i32 0
25 // CHECK-NEXT: i32 2
26 // CHECK-NEXT: ]
27