@@ -942,6 +942,7 @@ void SILParser::convertRequirements(SILFunction *F,
942
942
static bool parseDeclSILOptional (bool *isTransparent,
943
943
IsSerialized_t *isSerialized,
944
944
bool *isCanonical,
945
+ bool *hasOwnershipSSA,
945
946
IsThunk_t *isThunk,
946
947
IsDynamicallyReplaceable_t *isDynamic,
947
948
SILFunction **dynamicallyReplacedFunction,
@@ -976,6 +977,8 @@ static bool parseDeclSILOptional(bool *isTransparent,
976
977
*isSerialized = IsSerializable;
977
978
else if (isCanonical && SP.P .Tok .getText () == " canonical" )
978
979
*isCanonical = true ;
980
+ else if (hasOwnershipSSA && SP.P .Tok .getText () == " ossa" )
981
+ *hasOwnershipSSA = true ;
979
982
else if (isThunk && SP.P .Tok .getText () == " thunk" )
980
983
*isThunk = IsThunk;
981
984
else if (isThunk && SP.P .Tok .getText () == " signature_optimized_thunk" )
@@ -5148,9 +5151,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
5148
5151
5149
5152
// If SILOwnership is enabled and we are not assuming that we are
5150
5153
// parsing unqualified SIL, look for printed value ownership kinds.
5151
- if (!F->getModule ()
5152
- .getOptions ()
5153
- .AssumeUnqualifiedOwnershipWhenParsing &&
5154
+ if (F->hasOwnership () &&
5154
5155
parseSILOwnership (OwnershipKind))
5155
5156
return true ;
5156
5157
@@ -5193,7 +5194,7 @@ bool SILParser::parseSILBasicBlock(SILBuilder &B) {
5193
5194
// Qualification. For more details, see the comment on the
5194
5195
// FunctionOwnershipEvaluator class.
5195
5196
SILInstruction *ParsedInst = &*BB->rbegin ();
5196
- if (!AssumeUnqualifiedOwnershipWhenParsing &&
5197
+ if (BB-> getParent ()-> hasOwnership () &&
5197
5198
!OwnershipEvaluator.evaluate (ParsedInst)) {
5198
5199
P.diagnose (ParsedInst->getLoc ().getSourceLoc (),
5199
5200
diag::found_unqualified_instruction_in_qualified_function,
@@ -5228,6 +5229,7 @@ bool SILParserTUState::parseDeclSIL(Parser &P) {
5228
5229
IsSerialized_t isSerialized = IsNotSerialized;
5229
5230
bool isCanonical = false ;
5230
5231
IsDynamicallyReplaceable_t isDynamic = IsNotDynamic;
5232
+ bool hasOwnershipSSA = false ;
5231
5233
IsThunk_t isThunk = IsNotThunk;
5232
5234
bool isGlobalInit = false , isWeakLinked = false ;
5233
5235
bool isWithoutActuallyEscapingThunk = false ;
@@ -5240,12 +5242,12 @@ bool SILParserTUState::parseDeclSIL(Parser &P) {
5240
5242
SILFunction *DynamicallyReplacedFunction = nullptr ;
5241
5243
Identifier objCReplacementFor;
5242
5244
if (parseSILLinkage (FnLinkage, P) ||
5243
- parseDeclSILOptional (&isTransparent, &isSerialized, &isCanonical,
5244
- &isThunk , &isDynamic , &DynamicallyReplacedFunction ,
5245
- &objCReplacementFor , &isGlobalInit , &inlineStrategy ,
5246
- &optimizationMode, nullptr , &isWeakLinked ,
5247
- &isWithoutActuallyEscapingThunk, &Semantics,
5248
- &SpecAttrs, &ClangDecl, &MRK, FunctionState, M) ||
5245
+ parseDeclSILOptional (
5246
+ &isTransparent, &isSerialized , &isCanonical , &hasOwnershipSSA ,
5247
+ &isThunk , &isDynamic , &DynamicallyReplacedFunction ,
5248
+ &objCReplacementFor, &isGlobalInit, &inlineStrategy, &optimizationMode, nullptr ,
5249
+ &isWeakLinked, &isWithoutActuallyEscapingThunk, &Semantics,
5250
+ &SpecAttrs, &ClangDecl, &MRK, FunctionState, M) ||
5249
5251
P.parseToken (tok::at_sign, diag::expected_sil_function_name) ||
5250
5252
P.parseIdentifier (FnName, FnNameLoc, diag::expected_sil_function_name) ||
5251
5253
P.parseToken (tok::colon, diag::expected_sil_type))
@@ -5269,6 +5271,8 @@ bool SILParserTUState::parseDeclSIL(Parser &P) {
5269
5271
FunctionState.F ->setTransparent (IsTransparent_t (isTransparent));
5270
5272
FunctionState.F ->setSerialized (IsSerialized_t (isSerialized));
5271
5273
FunctionState.F ->setWasDeserializedCanonical (isCanonical);
5274
+ if (!hasOwnershipSSA)
5275
+ FunctionState.F ->setOwnershipEliminated ();
5272
5276
FunctionState.F ->setThunk (IsThunk_t (isThunk));
5273
5277
FunctionState.F ->setIsDynamic (isDynamic);
5274
5278
FunctionState.F ->setDynamicallyReplacedFunction (
@@ -5457,9 +5461,8 @@ bool SILParserTUState::parseSILGlobal(Parser &P) {
5457
5461
SILParser State (P);
5458
5462
if (parseSILLinkage (GlobalLinkage, P) ||
5459
5463
parseDeclSILOptional (nullptr , &isSerialized, nullptr , nullptr , nullptr ,
5460
- nullptr , nullptr , nullptr , nullptr , nullptr , &isLet,
5461
5464
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5462
- State, M) ||
5465
+ &isLet, nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , State, M) ||
5463
5466
P.parseToken (tok::at_sign, diag::expected_sil_value_name) ||
5464
5467
P.parseIdentifier (GlobalName, NameLoc, diag::expected_sil_value_name) ||
5465
5468
P.parseToken (tok::colon, diag::expected_sil_type))
@@ -5507,8 +5510,7 @@ bool SILParserTUState::parseSILProperty(Parser &P) {
5507
5510
IsSerialized_t Serialized = IsNotSerialized;
5508
5511
if (parseDeclSILOptional (nullptr , &Serialized, nullptr , nullptr , nullptr ,
5509
5512
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5510
- nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5511
- SP, M))
5513
+ nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , SP, M))
5512
5514
return true ;
5513
5515
5514
5516
ValueDecl *VD;
@@ -5576,7 +5578,7 @@ bool SILParserTUState::parseSILVTable(Parser &P) {
5576
5578
IsSerialized_t Serialized = IsNotSerialized;
5577
5579
if (parseDeclSILOptional (nullptr , &Serialized, nullptr , nullptr , nullptr ,
5578
5580
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5579
- nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5581
+ nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
5580
5582
VTableState, M))
5581
5583
return true ;
5582
5584
@@ -6112,7 +6114,7 @@ bool SILParserTUState::parseSILWitnessTable(Parser &P) {
6112
6114
IsSerialized_t isSerialized = IsNotSerialized;
6113
6115
if (parseDeclSILOptional (nullptr , &isSerialized, nullptr , nullptr , nullptr ,
6114
6116
nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
6115
- nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
6117
+ nullptr , nullptr , nullptr , nullptr , nullptr , nullptr , nullptr ,
6116
6118
WitnessState, M))
6117
6119
return true ;
6118
6120
0 commit comments