Skip to content

Conversation

aschwaighofer
Copy link
Contributor

No description provided.

@aschwaighofer aschwaighofer changed the title Fix convert escape_to_noescape non-dominance errors Fix convert_escape_to_noescape non-dominance errors Mar 29, 2018
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 38e8c44edb23d339bb9220bc74c2d2e2fe64b7c2

Copy link
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any change in functionality. Just default arguments. And I don't see any new CHECK lines in the test (only saw the first commit first time around).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

80-col (git format)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore my previous comment. I'm not sure why this didn't show up in my first review. It's not clear why you want to use a double negative everywhere instead of just postponeNoEscapeCleanup = true.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but why are you doing this transformation? Please explain in the comment why the SIL input to DI is invalid.

@atrick
Copy link
Contributor

atrick commented Mar 30, 2018

What happens when the SIL deviates from this elaborate pattern and DI bails out?
(e.g. why only handle one destroy?) Do we end up with a dominance
failure? Ownership violation?

How is this elaborate pattern tied to the SILGen functionality that you added? Can we just add an instruction, like mark_uninitialized, that communicates the situation to DI rather than assuming we can precisely recognize SILGen's output in all situations.

I assume this was arrived at after eliminating reasonable approaches:

  • +0 switch_enum: SILGen can't generally handle this?
  • allow convert_escape_to_noescape to directly handle optional casts (at least up to DI)?

@aschwaighofer
Copy link
Contributor Author

This is a plaster until I have time to remove PostponedCleanup in favor of a full implementation (the mark_initalized way your are eluding to) of handling the postponement in DI. I want to get rid of postponement in SILGen.

@slavapestov
Copy link
Contributor

Instead of DI, can the long term fix introduce a new SIL pass? This is not really related to DI.

@aschwaighofer
Copy link
Contributor Author

Sure.

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test linux

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 38e8c44edb23d339bb9220bc74c2d2e2fe64b7c2

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test os x

…ide an bind optional

This would violate dominance since the convertEscapeToNoEscape
instruction does not dominate the postpone point.

rdar://38124009
…_noescape [not_guaranteed] operand

Either through a peephole or we keep the closure operand alive to the end of the function

rdar://38124009
@aschwaighofer aschwaighofer force-pushed the fix_convert_escape_to_noescape_non_dominance branch from 597c8e9 to f40ac5d Compare March 30, 2018 16:31
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 38e8c44edb23d339bb9220bc74c2d2e2fe64b7c2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 597c8e9e2fe3c51f54447586275d52c71493bc0a

@aschwaighofer
Copy link
Contributor Author

The new patchset adds patches that make sure we ensure the lifetime of the escaping closure: either through the peephole or by keeping the closure alive to the end of the function if the peephole fails.

@aschwaighofer
Copy link
Contributor Author

There should be documentation other than in my head that 'convert_escape_to_noescape [not_guaranteed]' means that a pass must be run after SILGen that ensures the lifetime of the escaping closure extends beyond the last use of the trivial closure result.

/// Write an instruction that looks exactly like a conversion: all
/// important information is encoded in the operand and the result type.
void SILSerializer::writeConversionLikeInstruction(const SingleValueInstruction *I) {
__attribute__((noinline))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going away in a follow-up.

@aschwaighofer
Copy link
Contributor Author

@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

@aschwaighofer aschwaighofer merged commit 0f89a8d into swiftlang:master Mar 30, 2018
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.

4 participants