Skip to content

Commit db6b4a9

Browse files
committed
SILGen: Simplify logic in LocalArchetypeTransform
1 parent a1462ef commit db6b4a9

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

lib/SILGen/SILGenLocalArchetype.cpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,29 +110,9 @@ class LocalArchetypeTransform : public SILCloner<LocalArchetypeTransform> {
110110
// Insert the new entry block at the beginning.
111111
F.moveBlockBefore(clonedEntryBlock, F.begin());
112112

113-
// FIXME: This should be a common utility.
114-
115113
// Erase the old basic blocks.
116114
for (auto *bb : bbs) {
117-
for (SILArgument *arg : bb->getArguments()) {
118-
arg->replaceAllUsesWithUndef();
119-
// To appease the ownership verifier, just set to None.
120-
arg->setOwnershipKind(OwnershipKind::None);
121-
}
122-
123-
// Instructions in the dead block may be used by other dead blocks. Replace
124-
// any uses of them with undef values.
125-
while (!bb->empty()) {
126-
// Grab the last instruction in the bb.
127-
auto *inst = &bb->back();
128-
129-
// Replace any still-remaining uses with undef values and erase.
130-
inst->replaceAllUsesOfAllResultsWithUndef();
131-
inst->eraseFromParent();
132-
}
133-
134-
// Finally, erase the basic block itself.
135-
bb->eraseFromParent();
115+
bb->removeDeadBlock();
136116
}
137117
}
138118
};

0 commit comments

Comments
 (0)