File: coro-split-recursive.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (38 lines) | stat: -rw-r--r-- 1,238 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
; RUN: opt -passes='module(coro-early),cgscc(coro-split)' -S < %s | FileCheck %s

declare token @llvm.coro.id(i32, ptr readnone, ptr nocapture readonly, ptr)

declare ptr @llvm.coro.begin(token, ptr writeonly)

declare token @llvm.coro.save(ptr)

declare i8 @llvm.coro.suspend(token, i1)

declare i1 @get.i1()

; CHECK-LABEL: define void @foo()
; CHECK-LABEL: define {{.*}}void @foo.resume(
; CHECK: call void @foo()
; CHECK-LABEL: define {{.*}}void @foo.destroy(

define void @foo() presplitcoroutine {
entry:
  %__promise = alloca i32, align 8
  %0 = call token @llvm.coro.id(i32 16, ptr %__promise, ptr null, ptr null)
  %1 = call ptr @llvm.coro.begin(token %0, ptr null)
  %c = call i1 @get.i1()
  br i1 %c, label %if.then154, label %init.suspend

init.suspend:                                     ; preds = %entry
  %save = call token @llvm.coro.save(ptr null)
  %i3 = call i8 @llvm.coro.suspend(token %save, i1 false)
  %cond = icmp eq i8 %i3, 0
  br i1 %cond, label %if.then154, label %invoke.cont163

if.then154:                                       ; preds = %init.suspend, %entry
  call void @foo()
  br label %invoke.cont163

invoke.cont163:                                   ; preds = %if.then154, %init.suspend
  ret void
}