@@ -96,29 +96,29 @@ bool CanonicalizeBorrowScope::isRewritableOSSAForward(SILInstruction *inst) {
9696 if (inst->getNumOperands () != 1 )
9797 return false ;
9898
99- if (isa<OwnershipForwardingSingleValueInstruction>(inst) ||
100- isa<OwnershipForwardingMultipleValueInstruction>(inst)) {
101- Operand *forwardedOper = &inst->getOperandRef (0 );
102- // Trivial conversions do not need to be hoisted out of a borrow scope.
103- auto operOwnership = forwardedOper->getOperandOwnership ();
104- if (operOwnership == OperandOwnership::TrivialUse)
105- return false ;
106- // Don't mess with unowned conversions. They need to be copied immediately.
107- if (operOwnership != OperandOwnership::GuaranteedForwarding &&
108- operOwnership != OperandOwnership::ForwardingConsume) {
109- return false ;
110- }
111- assert (operOwnership == OperandOwnership::GuaranteedForwarding ||
112- operOwnership == OperandOwnership::ForwardingConsume);
113-
114- // Filter instructions that belong to a Forwarding*ValueInst mixin but
115- // cannot be converted to forward owned value (struct_extract).
116- if (!canOpcodeForwardOwnedValues (forwardedOper))
117- return false ;
99+ if (!isa<OwnershipForwardingSingleValueInstruction>(inst) &&
100+ !isa<OwnershipForwardingMultipleValueInstruction>(inst))
101+ return false ;
118102
119- return true ;
103+ Operand *forwardedOper = &inst->getOperandRef (0 );
104+ // Trivial conversions do not need to be hoisted out of a borrow scope.
105+ auto operOwnership = forwardedOper->getOperandOwnership ();
106+ if (operOwnership == OperandOwnership::TrivialUse)
107+ return false ;
108+ // Don't mess with unowned conversions. They need to be copied immediately.
109+ if (operOwnership != OperandOwnership::GuaranteedForwarding &&
110+ operOwnership != OperandOwnership::ForwardingConsume) {
111+ return false ;
120112 }
121- return false ;
113+ assert (operOwnership == OperandOwnership::GuaranteedForwarding ||
114+ operOwnership == OperandOwnership::ForwardingConsume);
115+
116+ // Filter instructions that belong to a Forwarding*ValueInst mixin but
117+ // cannot be converted to forward owned value (struct_extract).
118+ if (!canOpcodeForwardOwnedValues (forwardedOper))
119+ return false ;
120+
121+ return true ;
122122}
123123
124124// / Return the root of a borrowed extended lifetime for \p def or invalid.
0 commit comments