Skip to content

Commit b40aa54

Browse files
authored
Merge pull request swiftlang#34637 from gottesmm/pr-027a025e7a95d70fcc7e98300987826a5948c8c4
[ownership] Move type dependent operand check out of the main visitor to eliminate another returning of an empty map from the visitor.
2 parents 93d1524 + b5c3f71 commit b40aa54

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/SIL/IR/OperandOwnership.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,11 @@ OperandOwnershipKindClassifier::visitFullApply(FullApplySite apply) {
570570
return Map::allLive();
571571
}
572572

573-
// If we have a type dependent operand, return an empty map.
574-
if (apply.getInstruction()->isTypeDependentOperand(op))
575-
return Map();
573+
// We should have early exited if we saw a type dependent operand, so we
574+
// should never hit this.
575+
//
576+
// Lets just assert to be careful though.
577+
assert(!apply.getInstruction()->isTypeDependentOperand(op));
576578

577579
unsigned argIndex = apply.getCalleeArgIndex(op);
578580
auto conv = apply.getSubstCalleeConv();
@@ -972,6 +974,8 @@ OperandOwnershipKindClassifier::visitBuiltinInst(BuiltinInst *bi) {
972974
//===----------------------------------------------------------------------===//
973975

974976
OperandOwnershipKindMap Operand::getOwnershipKindMap() const {
977+
if (isTypeDependent())
978+
return OperandOwnershipKindMap();
975979
OperandOwnershipKindClassifier classifier(getUser()->getModule(), *this);
976980
return classifier.visit(const_cast<SILInstruction *>(getUser()));
977981
}

0 commit comments

Comments
 (0)