Skip to content

Commit 1131fe1

Browse files
authored
Merge pull request #23821 from gottesmm/pr-1984671c8601f1f0c2087a5e22be5f3473533606
[sil] Replace some nstances of SILBuilder(...) with SILBuilderWithSco…
2 parents 589615d + 8feb1a1 commit 1131fe1

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

lib/SIL/BasicBlockUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ SILBasicBlock *swift::splitEdge(TermInst *T, unsigned edgeIdx,
220220
SmallVector<SILValue, 16> args;
221221
getEdgeArgs(T, edgeIdx, edgeBB, args);
222222

223-
SILBuilder(edgeBB).createBranch(T->getLoc(), destBB, args);
223+
SILBuilderWithScope(edgeBB, T).createBranch(T->getLoc(), destBB, args);
224224

225225
// Strip the arguments and rewire the branch in the source block.
226226
changeBranchTarget(T, edgeIdx, edgeBB, /*PreserveArgs=*/false);

lib/SILOptimizer/LoopTransforms/LoopUnroll.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,18 @@ static void redirectTerminator(SILBasicBlock *Latch, unsigned CurLoopIter,
239239
auto *CondBr = cast<CondBranchInst>(
240240
Latch->getSinglePredecessorBlock()->getTerminator());
241241
if (CondBr->getTrueBB() != Latch)
242-
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getTrueBB(),
243-
CondBr->getTrueArgs());
242+
SILBuilderWithScope(CondBr).createBranch(
243+
CondBr->getLoc(), CondBr->getTrueBB(), CondBr->getTrueArgs());
244244
else
245-
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getFalseBB(),
246-
CondBr->getFalseArgs());
245+
SILBuilderWithScope(CondBr).createBranch(
246+
CondBr->getLoc(), CondBr->getFalseBB(), CondBr->getFalseArgs());
247247
CondBr->eraseFromParent();
248248
return;
249249
}
250250

251251
// Otherwise, branch to the next iteration's header.
252-
SILBuilder(Br).createBranch(Br->getLoc(), NextIterationsHeader,
253-
Br->getArgs());
252+
SILBuilderWithScope(Br).createBranch(Br->getLoc(), NextIterationsHeader,
253+
Br->getArgs());
254254
Br->eraseFromParent();
255255
return;
256256
}
@@ -261,25 +261,25 @@ static void redirectTerminator(SILBasicBlock *Latch, unsigned CurLoopIter,
261261
// one.
262262
if (CurLoopIter == LastLoopIter) {
263263
if (CondBr->getTrueBB() == CurrentHeader) {
264-
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getFalseBB(),
265-
CondBr->getFalseArgs());
264+
SILBuilderWithScope(CondBr).createBranch(
265+
CondBr->getLoc(), CondBr->getFalseBB(), CondBr->getFalseArgs());
266266
} else {
267267
assert(CondBr->getFalseBB() == CurrentHeader);
268-
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getTrueBB(),
269-
CondBr->getTrueArgs());
268+
SILBuilderWithScope(CondBr).createBranch(
269+
CondBr->getLoc(), CondBr->getTrueBB(), CondBr->getTrueArgs());
270270
}
271271
CondBr->eraseFromParent();
272272
return;
273273
}
274274

275275
// Otherwise, branch to the next iteration's header.
276276
if (CondBr->getTrueBB() == CurrentHeader) {
277-
SILBuilder(CondBr).createCondBranch(
277+
SILBuilderWithScope(CondBr).createCondBranch(
278278
CondBr->getLoc(), CondBr->getCondition(), NextIterationsHeader,
279279
CondBr->getTrueArgs(), CondBr->getFalseBB(), CondBr->getFalseArgs());
280280
} else {
281281
assert(CondBr->getFalseBB() == CurrentHeader);
282-
SILBuilder(CondBr).createCondBranch(
282+
SILBuilderWithScope(CondBr).createCondBranch(
283283
CondBr->getLoc(), CondBr->getCondition(), CondBr->getTrueBB(),
284284
CondBr->getTrueArgs(), NextIterationsHeader, CondBr->getFalseArgs());
285285
}

lib/SILOptimizer/Utils/CheckedCastBrJumpThreading.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ void CheckedCastBrJumpThreading::Edit::modifyCFGForUnknownPreds() {
233233
if (auto *CMI = dyn_cast<ClassMethodInst>(Inst)) {
234234
if (CMI->getOperand() == stripClassCasts(CCBI->getOperand())) {
235235
// Replace checked_cast_br by branch to FailureBB.
236-
SILBuilder(CCBI->getParent()).createBranch(CCBI->getLoc(),
237-
CCBI->getFailureBB());
236+
SILBuilderWithScope(CCBI).createBranch(CCBI->getLoc(),
237+
CCBI->getFailureBB());
238238
CCBI->eraseFromParent();
239239
}
240240
}
@@ -275,8 +275,8 @@ modifyCFGForSuccessPreds(Optional<BasicBlockCloner> &Cloner) {
275275
auto *CCBI = cast<CheckedCastBranchInst>(CCBBlock->getTerminator());
276276

277277
if (InvertSuccess) {
278-
SILBuilder B(CCBBlock);
279-
B.createBranch(CCBI->getLoc(), CCBI->getFailureBB());
278+
SILBuilderWithScope(CCBI).createBranch(CCBI->getLoc(),
279+
CCBI->getFailureBB());
280280
CCBI->eraseFromParent();
281281
return;
282282
}
@@ -313,8 +313,8 @@ modifyCFGForSuccessPreds(Optional<BasicBlockCloner> &Cloner) {
313313

314314
// Add an unconditional jump at the end of the block.
315315
// Take argument value from the dominating BB
316-
SILBuilder(CCBBlock).createBranch(CCBI->getLoc(), CCBI->getSuccessBB(),
317-
{SuccessArg});
316+
SILBuilderWithScope(CCBI).createBranch(CCBI->getLoc(), CCBI->getSuccessBB(),
317+
{SuccessArg});
318318
CCBI->eraseFromParent();
319319
}
320320

0 commit comments

Comments
 (0)