1 ; REQUIRES: webassembly-registered-target
3 ; Tests that we wouldn't convert coro.resume to a musttail call if the target is
5 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S | FileCheck %s
7 target triple = "wasm32-unknown-unknown"
11 %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
12 %alloc = call ptr @malloc(i64 16) #3
13 %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
15 %save = call token @llvm.coro.save(ptr null)
16 %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
17 call fastcc void %addr1(ptr null)
19 %suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
20 switch i8 %suspend, label %exit [
21 i8 0, label %await.ready
25 %save2 = call token @llvm.coro.save(ptr null)
26 %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
27 call fastcc void %addr2(ptr null)
29 %suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
30 switch i8 %suspend2, label %exit [
35 call i1 @llvm.coro.end(ptr null, i1 false, token none)
41 declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
42 declare i1 @llvm.coro.alloc(token) #2
43 declare i64 @llvm.coro.size.i64() #3
44 declare ptr @llvm.coro.begin(token, ptr writeonly) #2
45 declare token @llvm.coro.save(ptr) #2
46 declare ptr @llvm.coro.frame() #3
47 declare i8 @llvm.coro.suspend(token, i1) #2
48 declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
49 declare i1 @llvm.coro.end(ptr, i1, token) #2
50 declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
51 declare ptr @malloc(i64)
54 attributes #0 = { presplitcoroutine }
55 attributes #1 = { argmemonly nounwind readonly }
56 attributes #2 = { nounwind }
57 attributes #3 = { nounwind readnone }