-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[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
Conversation
@swift-ci test |
e0fdf0c
to
21d6a86
Compare
@swift-ci test |
21d6a86
to
a0d6894
Compare
@swift-ci smoke test |
@swift-ci smoke test linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this 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
SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyBeginBorrow.swift
Outdated
Show resolved
Hide resolved
@@ -41,6 +41,8 @@ extension Value { | |||
} | |||
} | |||
|
|||
func findPointerEscape() -> Bool { bridged.findPointerEscape() } |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
a0d6894
to
b637f06
Compare
@swift-ci smoke test |
Do not bridge the hasPointerEscape flag until it is implemented.