mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Gardening] DCE: Use bound variable in branch.
Rather than reusing the source of the dyn_cast.
This commit is contained in:
@@ -747,7 +747,8 @@ bool DCE::removeDead() {
|
||||
// We want to replace dead terminators with unconditional branches to
|
||||
// the nearest post-dominator that has useful instructions.
|
||||
if (auto *termInst = dyn_cast<TermInst>(Inst)) {
|
||||
SILBasicBlock *postDom = nearestUsefulPostDominator(Inst->getParent());
|
||||
SILBasicBlock *postDom =
|
||||
nearestUsefulPostDominator(termInst->getParent());
|
||||
if (!postDom)
|
||||
continue;
|
||||
|
||||
@@ -757,12 +758,12 @@ bool DCE::removeDead() {
|
||||
}
|
||||
}
|
||||
LLVM_DEBUG(llvm::dbgs() << "Replacing branch: ");
|
||||
LLVM_DEBUG(Inst->dump());
|
||||
LLVM_DEBUG(termInst->dump());
|
||||
LLVM_DEBUG(llvm::dbgs()
|
||||
<< "with jump to: BB" << postDom->getDebugID() << "\n");
|
||||
|
||||
replaceBranchWithJump(Inst, postDom);
|
||||
Inst->eraseFromParent();
|
||||
replaceBranchWithJump(termInst, postDom);
|
||||
termInst->eraseFromParent();
|
||||
BranchesChanged = true;
|
||||
Changed = true;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user