[sil] Replace some nstances of SILBuilder(...) with SILBuilderWithScope(...).

The main thing to notice about these changes is that I always picked the debug
scope associated with the location we were using. They should always be in
sync.
This commit is contained in:
Michael Gottesman
2019-04-05 12:10:23 -07:00
parent e922d2923b
commit 8feb1a1000
3 changed files with 19 additions and 19 deletions

View File

@@ -239,18 +239,18 @@ static void redirectTerminator(SILBasicBlock *Latch, unsigned CurLoopIter,
auto *CondBr = cast<CondBranchInst>(
Latch->getSinglePredecessorBlock()->getTerminator());
if (CondBr->getTrueBB() != Latch)
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getTrueBB(),
CondBr->getTrueArgs());
SILBuilderWithScope(CondBr).createBranch(
CondBr->getLoc(), CondBr->getTrueBB(), CondBr->getTrueArgs());
else
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getFalseBB(),
CondBr->getFalseArgs());
SILBuilderWithScope(CondBr).createBranch(
CondBr->getLoc(), CondBr->getFalseBB(), CondBr->getFalseArgs());
CondBr->eraseFromParent();
return;
}
// Otherwise, branch to the next iteration's header.
SILBuilder(Br).createBranch(Br->getLoc(), NextIterationsHeader,
Br->getArgs());
SILBuilderWithScope(Br).createBranch(Br->getLoc(), NextIterationsHeader,
Br->getArgs());
Br->eraseFromParent();
return;
}
@@ -261,12 +261,12 @@ static void redirectTerminator(SILBasicBlock *Latch, unsigned CurLoopIter,
// one.
if (CurLoopIter == LastLoopIter) {
if (CondBr->getTrueBB() == CurrentHeader) {
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getFalseBB(),
CondBr->getFalseArgs());
SILBuilderWithScope(CondBr).createBranch(
CondBr->getLoc(), CondBr->getFalseBB(), CondBr->getFalseArgs());
} else {
assert(CondBr->getFalseBB() == CurrentHeader);
SILBuilder(CondBr).createBranch(CondBr->getLoc(), CondBr->getTrueBB(),
CondBr->getTrueArgs());
SILBuilderWithScope(CondBr).createBranch(
CondBr->getLoc(), CondBr->getTrueBB(), CondBr->getTrueArgs());
}
CondBr->eraseFromParent();
return;
@@ -274,12 +274,12 @@ static void redirectTerminator(SILBasicBlock *Latch, unsigned CurLoopIter,
// Otherwise, branch to the next iteration's header.
if (CondBr->getTrueBB() == CurrentHeader) {
SILBuilder(CondBr).createCondBranch(
SILBuilderWithScope(CondBr).createCondBranch(
CondBr->getLoc(), CondBr->getCondition(), NextIterationsHeader,
CondBr->getTrueArgs(), CondBr->getFalseBB(), CondBr->getFalseArgs());
} else {
assert(CondBr->getFalseBB() == CurrentHeader);
SILBuilder(CondBr).createCondBranch(
SILBuilderWithScope(CondBr).createCondBranch(
CondBr->getLoc(), CondBr->getCondition(), CondBr->getTrueBB(),
CondBr->getTrueArgs(), NextIterationsHeader, CondBr->getFalseArgs());
}