Yuanfang Chen fcb7d76d65 [coroutine] add nomerge function attribute to llvm.coro.save
It is illegal to merge two `llvm.coro.save` calls unless their
`llvm.coro.suspend` users are also merged. Marks it "nomerge" for
the moment.

This reverts D129025.

Alternative to D129025, which affects other token type users like WinEH.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D129530
2022-07-12 10:39:38 -07:00

23 lines
684 B
C++

// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
#include "Inputs/coroutine.h"
using namespace std;
struct coro {
struct promise_type {
coro get_return_object();
suspend_never initial_suspend();
suspend_never final_suspend() noexcept;
void return_void();
static void unhandled_exception();
};
};
// CHECK: void @_Z3foov() #[[FOO_ATTR_NUM:[0-9]+]]
// CHECK: declare token @llvm.coro.save(ptr) #[[SAVE_ATTR_NUM:[0-9]+]]
// CHECK: attributes #[[FOO_ATTR_NUM]] = { {{.*}} presplitcoroutine
// CHECK: attributes #[[SAVE_ATTR_NUM]] = { {{.*}}nomerge
coro foo() {
co_await suspend_always{};
}