[ownership] Change ReturnInst to have its ValueOwnershipKind stored within it rather than always recomputing from the function type.

This allows us to hoist the error case of having a function signature with
conflicting ownership requirements into the creation of the return inst instead
of at the time of computing Operand Constraints.

This is the last part of the Operand Constraint computation that can fail that
once removed will let me use fail to mean any constriant is allowed.
This commit is contained in:
Michael Gottesman
2020-11-09 13:48:46 -08:00
parent 4aa1ef3964
commit c7051d2929
4 changed files with 44 additions and 35 deletions

View File

@@ -1969,7 +1969,7 @@ public:
ReturnInst *createReturn(SILLocation Loc, SILValue ReturnValue) {
return insertTerminator(new (getModule()) ReturnInst(
getSILDebugLocation(Loc), ReturnValue));
getFunction(), getSILDebugLocation(Loc), ReturnValue));
}
ThrowInst *createThrow(SILLocation Loc, SILValue errorValue) {