Skip to content

Commit 7623367

Browse files
authored
Merge pull request #28295 from gottesmm/pr-5dfaf35e4af5aa2b6e46e3db704bc973cd4e6d53
[pmo] Fix load [copy] like I fixed load_borrow.
2 parents f44941d + 95de4d2 commit 7623367

File tree

5 files changed

+869
-190
lines changed

5 files changed

+869
-190
lines changed

include/swift/Basic/STLExtras.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,12 +639,12 @@ inline T accumulate(const Container &C, T init, BinaryOperation op) {
639639
}
640640

641641
template <typename Container, typename T>
642-
inline bool binary_search(const Container &C, T value) {
642+
inline bool binary_search(const Container &C, const T &value) {
643643
return std::binary_search(C.begin(), C.end(), value);
644644
}
645645

646646
template <typename Container, typename T, typename BinaryOperation>
647-
inline bool binary_search(const Container &C, T value, BinaryOperation op) {
647+
inline bool binary_search(const Container &C, const T &value, BinaryOperation op) {
648648
return std::binary_search(C.begin(), C.end(), value, op);
649649
}
650650

lib/SIL/OwnershipUtils.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,13 @@ bool swift::getUnderlyingBorrowIntroducingValues(
163163
continue;
164164
}
165165

166+
// If v produces .none ownership, then we can ignore it. It is important
167+
// that we put this before checking for guaranteed forwarding instructions,
168+
// since we want to ignore guaranteed forwarding instructions that in this
169+
// specific case produce a .none value.
170+
if (v.getOwnershipKind() == ValueOwnershipKind::None)
171+
continue;
172+
166173
// Otherwise if v is an ownership forwarding value, add its defining
167174
// instruction
168175
if (isGuaranteedForwardingValue(v)) {
@@ -173,10 +180,9 @@ bool swift::getUnderlyingBorrowIntroducingValues(
173180
continue;
174181
}
175182

176-
// If v produces any ownership, then we can ignore it. Otherwise, we need to
177-
// return false since this is an introducer we do not understand.
178-
if (v.getOwnershipKind() != ValueOwnershipKind::None)
179-
return false;
183+
// Otherwise, this is an introducer we do not understand. Bail and return
184+
// false.
185+
return false;
180186
}
181187

182188
return true;

0 commit comments

Comments
 (0)