1 ; Tests that some target (e.g. ppc) can support tail call under condition.
2 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S \
3 ; RUN: -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr9 | FileCheck %s
4 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S \
5 ; RUN: -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 --code-model=medium \
7 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S \
8 ; RUN: -mtriple=powerpc64le-unknown-linux-gnu -mcpu=pwr10 --code-model=medium -mattr=+longcall \
10 ; RUN: opt < %s -passes='cgscc(coro-split),simplifycfg,early-cse' -S \
11 ; RUN: -mtriple=ppc32-- | FileCheck %s
15 %id = call token @llvm.coro.id(i32 0, ptr null, ptr null, ptr null)
16 %alloc = call ptr @malloc(i64 16) #3
17 %vFrame = call noalias nonnull ptr @llvm.coro.begin(token %id, ptr %alloc)
19 %save = call token @llvm.coro.save(ptr null)
20 %addr1 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
21 call fastcc void %addr1(ptr null)
23 %suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
24 switch i8 %suspend, label %exit [
25 i8 0, label %await.ready
29 %save2 = call token @llvm.coro.save(ptr null)
30 %addr2 = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
31 call fastcc void %addr2(ptr null)
33 %suspend2 = call i8 @llvm.coro.suspend(token %save2, i1 false)
34 switch i8 %suspend2, label %exit [
39 call i1 @llvm.coro.end(ptr null, i1 false, token none)
43 ; Verify that in the initial function resume is not marked with musttail.
45 ; CHECK: %[[addr1:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
46 ; CHECK-NOT: musttail call fastcc void %[[addr1]](ptr null)
48 ; Verify that ppc target not using PC-Relative addressing in the resume part resume call is not marked with musttail.
49 ; CHECK-LABEL: @f.resume(
50 ; CHECK: %[[addr2:.+]] = call ptr @llvm.coro.subfn.addr(ptr null, i8 0)
51 ; CHECK-NEXT: call fastcc void %[[addr2]](ptr null)
53 declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr) #1
54 declare i1 @llvm.coro.alloc(token) #2
55 declare i64 @llvm.coro.size.i64() #3
56 declare ptr @llvm.coro.begin(token, ptr writeonly) #2
57 declare token @llvm.coro.save(ptr) #2
58 declare ptr @llvm.coro.frame() #3
59 declare i8 @llvm.coro.suspend(token, i1) #2
60 declare ptr @llvm.coro.free(token, ptr nocapture readonly) #1
61 declare i1 @llvm.coro.end(ptr, i1, token) #2
62 declare ptr @llvm.coro.subfn.addr(ptr nocapture readonly, i8) #1
63 declare ptr @malloc(i64)
65 attributes #0 = { presplitcoroutine }
66 attributes #1 = { argmemonly nounwind readonly }
67 attributes #2 = { nounwind }
68 attributes #3 = { nounwind readnone }