Skip to content

Lifetime dependence utilities #71055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 23, 2024
Merged

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Jan 22, 2024

Add LifetimeDependence utilities

  • LifetimeDependence
  • VariableIntroducerUseDefWalker
  • LifetimeDependenceUseDefWalker
  • LifetimeDependenceDefUseWalker

@atrick atrick requested a review from meg-gupta January 22, 2024 08:53
@atrick atrick force-pushed the lifetime-dependence branch from 41c0cf6 to 2ef870a Compare January 23, 2024 08:06
@atrick atrick marked this pull request as ready for review January 23, 2024 08:06
@atrick
Copy link
Contributor Author

atrick commented Jan 23, 2024

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented Jan 23, 2024

@swift-ci test source compatibility

@atrick
Copy link
Contributor Author

atrick commented Jan 23, 2024

@swift-ci benchmark

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm!

///
/// TODO: Integrate this with SIL verification to ensure completeness.
///
/// TODO: Convert AddressDefUseWalker to conform to AddressUtils after
Copy link
Contributor

Choose a reason for hiding this comment

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

How would that work? The problem is that AddressDefUseWalker is passing a Path down the walk functions.

// base is never a guaranteed phi.
guard let introducer = introducers.pop() else { return nil }
assert(introducers.isEmpty,
"guaranteed phis not allowed when diagnosing lifetime dependence")
Copy link
Contributor

Choose a reason for hiding this comment

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

Multiple introducers don't necessarily stem from phis. Think of the Pair example. Is this something to consider here?

/// %base = struct_extract %parent // lifetime dependence base value
/// %dependent = mark_dependence [nonescaping] %value on %base
///
/// This extends the ForwardingDefUseWalker, which finds the
Copy link
Contributor

Choose a reason for hiding this comment

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

ForwardingDefUseWalker -> ForwardingUseDefWalker

/// end_borrow %5 | -+ |
/// destroy_value %4 -+ |
/// ... |
/// destroy_value %parent // end dependence scope -+
Copy link
Contributor

Choose a reason for hiding this comment

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

nice comment!

@atrick atrick merged commit 246da83 into swiftlang:main Jan 23, 2024
@atrick atrick deleted the lifetime-dependence branch January 23, 2024 16:19
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.

2 participants