Skip to content

Commit 7fa884a

Browse files
committed
Allow functions with control point to return void.
1 parent e93b461 commit 7fa884a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Transforms/Yk/ControlPoint.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,12 @@ class YkControlPoint : public ModulePass {
363363
Builder.SetInsertPoint(ExitBB);
364364
// YKFIXME: We need to return the value of interpreted return and the return
365365
// type must be that of the control point's caller.
366-
Builder.CreateRet(ConstantInt::get(Type::getInt32Ty(Context), 0));
366+
Type *RetTy = Caller->getReturnType();
367+
if (RetTy->isVoidTy()) {
368+
Builder.CreateRetVoid();
369+
} else {
370+
Builder.CreateRet(ConstantInt::get(Type::getInt32Ty(Context), 0));
371+
}
367372

368373
// To do so we need to first split up the current block and then
369374
// insert a conditional branch that either continues or returns.

0 commit comments

Comments
 (0)