Skip to content

Commit 1f8397b

Browse files
committed
Fix a use-after-free error.
The code was trying to access a debug scope of the erased instruction.
1 parent 4c093cf commit 1f8397b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SILPasses/SILCombiner/SILCombinerApplyVisitors.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,9 @@ SILInstruction *SILCombiner::visitTryApplyInst(TryApplyInst *AI) {
13921392
SILBasicBlock *NormalBB = AI->getNormalBB();
13931393
SILBasicBlock *ErrorBB = AI->getErrorBB();
13941394
SILLocation Loc = AI->getLoc();
1395-
eraseApply(AI, Users);
13961395
Builder.setInsertionPoint(BB);
13971396
Builder.setCurrentDebugScope(AI->getDebugScope());
1397+
eraseApply(AI, Users);
13981398

13991399
// Replace the try_apply with a cond_br false, which will be removed by
14001400
// SimplifyCFG. We don't want to modify the CFG in SILCombine.

0 commit comments

Comments
 (0)