Skip to content

Commit 8512387

Browse files
committed
[mandatory-combine] Make sure to bail early if we have an external declaration.
Beyond creating a nice invariant, I am going to be using this invariant in some small code improvements to MandatoryCombine that assume we have an initial basic block.
1 parent b32e82c commit 8512387

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/SILOptimizer/Mandatory/MandatoryCombine.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ class MandatoryCombine final : public SILFunctionTransform {
282282
void run() override {
283283
auto *function = getFunction();
284284

285+
// If this function is an external declaration, bail. We only want to visit
286+
// functions with bodies.
287+
if (function->isExternalDeclaration()) {
288+
return;
289+
}
290+
285291
MandatoryCombiner combiner(createdInstructions);
286292
bool madeChange = combiner.runOnFunction(*function);
287293

0 commit comments

Comments
 (0)