Skip to content

[SIL] Bridge findPointerEscape() and fix OnoneSimplifyable #70479

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 1 commit into from
Dec 18, 2023

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Dec 15, 2023

Do not bridge the hasPointerEscape flag until it is implemented.

@atrick atrick requested a review from eeckstein as a code owner December 15, 2023 00:50
@atrick atrick requested review from eeckstein and removed request for eeckstein December 15, 2023 00:50
@atrick
Copy link
Contributor Author

atrick commented Dec 15, 2023

@swift-ci test

@atrick atrick force-pushed the no-pointer-escape-flag branch from e0fdf0c to 21d6a86 Compare December 15, 2023 00:58
@atrick
Copy link
Contributor Author

atrick commented Dec 15, 2023

@swift-ci test

@atrick atrick requested a review from meg-gupta December 15, 2023 04:09
@atrick atrick force-pushed the no-pointer-escape-flag branch from 21d6a86 to a0d6894 Compare December 15, 2023 04:23
@atrick
Copy link
Contributor Author

atrick commented Dec 15, 2023

@swift-ci smoke test

@atrick
Copy link
Contributor Author

atrick commented Dec 15, 2023

@swift-ci smoke test linux

Copy link
Contributor

@meg-gupta meg-gupta left a comment

Choose a reason for hiding this comment

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

LGTM

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.

basically lgtm.
Just a few minor comments

@@ -41,6 +41,8 @@ extension Value {
}
}

func findPointerEscape() -> Bool { bridged.findPointerEscape() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you copy the comment from the C++ function?

nitpick: I would find it a bit more self describing if this is a top-level function findPointerEscape(inLiferangeOf: Value) -> Bool

Copy link
Contributor Author

@atrick atrick Dec 15, 2023

Choose a reason for hiding this comment

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

Value should have a hasPointerEscape method in primary declaration, not an extension. It is an important property of the type that changes the semantics. Anyone who needs to maintain the OSSA correctness of the Value needs to first check this. Of course, calling that method should not require a def-use traversal, but that is a hack until we have flags.

But since you mention what goes in an extension, I don't think any of the utilities in OptUtils should extend the basic SIL types: Value and Instruction. They are algorithms specific to some task. They don't meet any of the requirements for extending a type. They are not fundamental to the type, they don't affect how anyone else would use the type, and they don't require any internal knowledge of the type.

isTrivial is a great example where we need clarity. When written as an extension on Value, it will be confused with whether the value has trivial ownership (value.type.isTrivial). But this implementation is different, and its meaning may change after unrelated transformations.

Do not bridge the hasPointerEscape flag until it is implemented.
@atrick atrick force-pushed the no-pointer-escape-flag branch from a0d6894 to b637f06 Compare December 18, 2023 17:31
@atrick
Copy link
Contributor Author

atrick commented Dec 18, 2023

@swift-ci smoke test

@atrick atrick enabled auto-merge December 18, 2023 17:35
@atrick atrick merged commit 6cc5d67 into swiftlang:main Dec 18, 2023
@atrick atrick deleted the no-pointer-escape-flag branch December 18, 2023 21:06
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.

3 participants