Skip to content

Commit 1aface0

Browse files
committed
workaround for llvm.coro.save being broken
1 parent 3a0cb77 commit 1aface0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

transform/goroutine.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,11 +689,6 @@ func (c *coroutineLoweringPass) lowerFuncCoro(fn *asyncFunc) {
689689
// Lower return value of call.
690690
c.lowerCallReturn(fn, call)
691691

692-
// Save coroutine state before calling the function.
693-
// %coro.save = call token @llvm.coro.save(i8* %coro.state)
694-
c.builder.SetInsertPointBefore(call)
695-
save := c.builder.CreateCall(c.coroSave, []llvm.Value{coroState}, "coro.save")
696-
697692
// Get originating basic block.
698693
bb := call.InstructionParent()
699694

@@ -702,6 +697,8 @@ func (c *coroutineLoweringPass) lowerFuncCoro(fn *asyncFunc) {
702697

703698
// Insert suspension and switch.
704699
c.builder.SetInsertPointAtEnd(bb)
700+
// %coro.save = call token @llvm.coro.save(i8* %coro.state)
701+
save := c.builder.CreateCall(c.coroSave, []llvm.Value{coroState}, "coro.save")
705702
// %call.suspend = llvm.coro.suspend(token %coro.save, i1 false)
706703
// switch i8 %call.suspend, label %suspend [i8 0, label %wakeup
707704
// i8 1, label %cleanup]

0 commit comments

Comments
 (0)