Skip to content

Conversation

@gottesmm
Copy link
Contributor

This PR contains a sequence of commits that:

  1. Move ValueOwnershipKind into SILArgument and provides a unified interface therein to ownership kind.
  2. Updates function signature optimization to propagate FunctionArgument's proper ValueOwnershipKind.
  3. Adds code so that all function arguments have correct ownership and verifies that the ValueOwnershipKind is correct in the verifier.
  4. Removes all places in the compiler that created PHI arguments with Any ownership with an initial approximation of the correct ownership. This means that creating a PHI arguments with Any ownership will cause an assert. Now the only thing that can have Any ownership is SILUndef (or potentially values derived from SILUndef). The initial approximation of correct ownership is not checked though. I am going to be going through the compiler with the verifier to make sure that they are correct, but I need some "initial" value to start.

rdar://29791263

…sses pass in said value.

This in the case of insertFunctionArgument requires a ValueOwnershipKind to be
specified since we use that for transformations of function argument lists that
are only correct after the transformation is complete. This only occurs in
FunctionSignatureOptimizations.

On the other hand, createFunctionArgument is only used to construct completely
new argument lists, so we can instead just rely on the function we are in rather
than require the user to pass it in.

rdar://29791263
…correct ValueOwnershipKind into FunctionSignatureOpts.

rdar://29791263
…nership kind and create a verifier check that this is preserved.

rdar://29791263
… in Semantic SIL.

Most of this involved sprinkling ValueOwnershipKind::Owned in many places. In
some of these places, I am sure I was too cavalier and I expect some of them to
be trivial. The verifier will help me to track those down.

On the other hand, I do expect there to be some places where we are willing to
accept guaranteed+trivial or owned+trivial. In those cases, I am going to
provide an aggregate ValueOwnershipKind that will then tell SILArgument that it
should disambiguate using the type. This will eliminate the ackwardness from
such code.

I am going to use a verifier to fix such cases.

This commit also begins the serialization of ValueOwnershipKind of arguments,
but does not implement parsing of value ownership kinds. That and undef are the
last places that we still use ValueOwnershipKind::Any.

rdar://29791263
@gottesmm
Copy link
Contributor Author

@swift-ci Please test and merge

@gottesmm
Copy link
Contributor Author

Playground logger failure is not mine. Infrastructure issue (couldn't connect to window server?!)

@gottesmm
Copy link
Contributor Author

@swift-ci Please smoke test OS X platform

@gottesmm gottesmm merged commit 2ebdb7f into swiftlang:master Jan 11, 2017
@gottesmm gottesmm deleted the silargument_ownershipkind branch January 11, 2017 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant