Skip to content

Revert "[pmo] Fix load [copy] like I fixed load_borrow." #28308

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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/swift/Basic/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -639,12 +639,12 @@ inline T accumulate(const Container &C, T init, BinaryOperation op) {
}

template <typename Container, typename T>
inline bool binary_search(const Container &C, const T &value) {
inline bool binary_search(const Container &C, T value) {
return std::binary_search(C.begin(), C.end(), value);
}

template <typename Container, typename T, typename BinaryOperation>
inline bool binary_search(const Container &C, const T &value, BinaryOperation op) {
inline bool binary_search(const Container &C, T value, BinaryOperation op) {
return std::binary_search(C.begin(), C.end(), value, op);
}

Expand Down
14 changes: 4 additions & 10 deletions lib/SIL/OwnershipUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,6 @@ bool swift::getUnderlyingBorrowIntroducingValues(
continue;
}

// If v produces .none ownership, then we can ignore it. It is important
// that we put this before checking for guaranteed forwarding instructions,
// since we want to ignore guaranteed forwarding instructions that in this
// specific case produce a .none value.
if (v.getOwnershipKind() == ValueOwnershipKind::None)
continue;

// Otherwise if v is an ownership forwarding value, add its defining
// instruction
if (isGuaranteedForwardingValue(v)) {
Expand All @@ -180,9 +173,10 @@ bool swift::getUnderlyingBorrowIntroducingValues(
continue;
}

// Otherwise, this is an introducer we do not understand. Bail and return
// false.
return false;
// If v produces any ownership, then we can ignore it. Otherwise, we need to
// return false since this is an introducer we do not understand.
if (v.getOwnershipKind() != ValueOwnershipKind::None)
return false;
}

return true;
Expand Down
Loading