Skip to content

Commit e5e3b1d

Browse files
committed
Remove branch after control point.
Since deoptimisation now doesn't require us to return to the control point anymore, we can remove the control points return type and the branch with the call to the frame reconstruction code.
1 parent 9c9f169 commit e5e3b1d

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

llvm/lib/Transforms/Yk/ControlPoint.cpp

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ class YkControlPoint : public ModulePass {
162162
->getType();
163163

164164
// Create the new control point, which is of the form:
165-
// void* new_control_point(YkMT*, YkLocation*, CtrlPointVars*, void*)
165+
// void new_control_point(YkMT*, YkLocation*, CtrlPointVars*, void*)
166166
PointerType *VoidPtr = PointerType::get(Context, 0);
167167
FunctionType *FType = FunctionType::get(
168-
VoidPtr, {YkMTTy, YkLocTy, CtrlPointVarsTy->getPointerTo(), VoidPtr},
169-
false);
168+
Type::getVoidTy(Context),
169+
{YkMTTy, YkLocTy, CtrlPointVarsTy->getPointerTo(), VoidPtr}, false);
170170
Function *NF = Function::Create(FType, GlobalVariable::ExternalLinkage,
171171
YK_NEW_CONTROL_POINT, M);
172172

@@ -219,35 +219,6 @@ class YkControlPoint : public ModulePass {
219219
// Replace the call to the dummy control point.
220220
OldCtrlPointCall->eraseFromParent();
221221

222-
// Create the new exit block.
223-
BasicBlock *ExitBB = BasicBlock::Create(Context, "", Caller);
224-
Builder.SetInsertPoint(ExitBB);
225-
226-
// Create call to frame reconstructor.
227-
FunctionType *YKFRType =
228-
FunctionType::get(Type::getVoidTy(Context), {VoidPtr}, false);
229-
Function *YKFR = Function::Create(YKFRType, GlobalVariable::ExternalLinkage,
230-
YK_RECONSTRUCT_FRAMES, M);
231-
Builder.CreateCall(YKFR, {NewCtrlPointCallInst});
232-
Builder.CreateUnreachable();
233-
234-
// Split up the current block and then insert a conditional branch that
235-
// either continues after the control point or invokes frame reconstruction.
236-
BasicBlock *BB = NewCtrlPointCallInst->getParent();
237-
BasicBlock *ContBB = BB->splitBasicBlock(New->getNextNonDebugInstruction());
238-
Instruction &OldBr = BB->back();
239-
assert(OldBr.getPrevNonDebugInstruction() == New &&
240-
"Split block at the wrong spot.");
241-
OldBr.eraseFromParent();
242-
Builder.SetInsertPoint(BB);
243-
// The return value of the control point tells us whether a guard has failed
244-
// or not (i.e. anything other than a nullptr means a guard has failed). If
245-
// it has jump to `ExitBB` which calls the code that copies over the new
246-
// stack from the given pointer.
247-
Value *HasGuardFailed = Builder.CreateICmpEQ(
248-
NewCtrlPointCallInst, ConstantPointerNull::get(VoidPtr));
249-
Builder.CreateCondBr(HasGuardFailed, ContBB, ExitBB);
250-
251222
#ifndef NDEBUG
252223
// Our pass runs after LLVM normally does its verify pass. In debug builds
253224
// we run it again to check that our pass is generating valid IR.

0 commit comments

Comments
 (0)