Skip to content

Commit b5c3f71

Browse files
committed
[ownership] Move type dependent operand check out of the main visitor to eliminate another returning of an empty map from the visitor.
I may turn this into an assert, but for now I am preserving the current behavior albeit moving the bad behavior out of the visitor to the front of the API.
1 parent 6f60a17 commit b5c3f71

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
@@ -622,9 +622,11 @@ OperandOwnershipKindClassifier::visitFullApply(FullApplySite apply) {
622622
return Map::allLive();
623623
}
624624

625-
// If we have a type dependent operand, return an empty map.
626-
if (apply.getInstruction()->isTypeDependentOperand(op))
627-
return Map();
625+
// We should have early exited if we saw a type dependent operand, so we
626+
// should never hit this.
627+
//
628+
// Lets just assert to be careful though.
629+
assert(!apply.getInstruction()->isTypeDependentOperand(op));
628630

629631
unsigned argIndex = apply.getCalleeArgIndex(op);
630632
auto conv = apply.getSubstCalleeConv();
@@ -1024,6 +1026,8 @@ OperandOwnershipKindClassifier::visitBuiltinInst(BuiltinInst *bi) {
10241026
//===----------------------------------------------------------------------===//
10251027

10261028
OperandOwnershipKindMap Operand::getOwnershipKindMap() const {
1029+
if (isTypeDependent())
1030+
return OperandOwnershipKindMap();
10271031
OperandOwnershipKindClassifier classifier(getUser()->getModule(), *this);
10281032
return classifier.visit(const_cast<SILInstruction *>(getUser()));
10291033
}

0 commit comments

Comments
 (0)