File tree Expand file tree Collapse file tree 1 file changed +1
-21
lines changed Expand file tree Collapse file tree 1 file changed +1
-21
lines changed Original file line number Diff line number Diff line change @@ -110,29 +110,9 @@ class LocalArchetypeTransform : public SILCloner<LocalArchetypeTransform> {
110
110
// Insert the new entry block at the beginning.
111
111
F.moveBlockBefore (clonedEntryBlock, F.begin ());
112
112
113
- // FIXME: This should be a common utility.
114
-
115
113
// Erase the old basic blocks.
116
114
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 ();
136
116
}
137
117
}
138
118
};
You can’t perform that action at this time.
0 commit comments