Skip to content

Commit cce4442

Browse files
authored
Merge pull request #39880 from kubamracek/revert-df26a6d7407d42e9646c883489ced31ceb700674
Revert "Merge pull request #39805 from atrick/oou-opt-rauw"
2 parents 48eab6d + 8158cdf commit cce4442

File tree

2 files changed

+85
-301
lines changed

2 files changed

+85
-301
lines changed

lib/SILOptimizer/Utils/OwnershipOptUtils.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,6 @@ static bool canFixUpOwnershipForRAUW(SILValue oldValue, SILValue newValue,
350350
if (oldValue.getOwnershipKind() != OwnershipKind::Guaranteed)
351351
return true;
352352

353-
SILValue newRoot = findOwnershipReferenceAggregate(newValue);
354-
if (newRoot && isa<SILFunctionArgument>(newRoot)
355-
&& newRoot->getOwnershipKind() == OwnershipKind::Guaranteed) {
356-
return true;
357-
}
358353
// Check that the old lifetime can be extended and record the necessary
359354
// book-keeping in the OwnershipFixupContext.
360355
context.clear();
@@ -875,10 +870,9 @@ SILValue
875870
OwnershipLifetimeExtender::borrowOverValue(SILValue newValue,
876871
SILValue guaranteedValue) {
877872
// Avoid borrowing guaranteed function arguments.
878-
if (newValue.getOwnershipKind() == OwnershipKind::Guaranteed) {
879-
SILValue newRoot = findOwnershipReferenceAggregate(newValue);
880-
if (newRoot && isa<SILFunctionArgument>(newRoot))
881-
return newValue;
873+
if (isa<SILFunctionArgument>(newValue)
874+
&& newValue.getOwnershipKind() == OwnershipKind::Guaranteed) {
875+
return newValue;
882876
}
883877
auto borrowedValue = BorrowedValue(guaranteedValue);
884878
if (borrowedValue && borrowedValue.isLocalScope()) {

0 commit comments

Comments
 (0)