Skip to content

Commit 8d28bec

Browse files
committed
[ShrinkBorrowScope] Used extract deinit barrier implementation.
In 0325e29, the implementation of deinit barrier predicate was copied out of ShrinkBorrowScope into MemAccessUtils. Delete the source of that copy from ShrinkBorrowScope and just call the now common utility.
1 parent d6ab215 commit 8d28bec

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

lib/SILOptimizer/Utils/ShrinkBorrowScope.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,35 +88,6 @@ class ShrinkBorrowScope {
8888
bool rewrite();
8989
bool createEndBorrow(SILInstruction *insertionPoint);
9090

91-
bool isBarrierApply(SILInstruction *instruction) {
92-
// For now, treat every apply (that doesn't use the borrowed value) as a
93-
// barrier.
94-
return isa<ApplySite>(instruction);
95-
}
96-
97-
bool mayAccessPointer(SILInstruction *instruction) {
98-
if (!instruction->mayReadOrWriteMemory())
99-
return false;
100-
bool fail = false;
101-
visitAccessedAddress(instruction, [&fail](Operand *operand) {
102-
auto accessStorage = AccessStorage::compute(operand->get());
103-
if (accessStorage.getKind() != AccessRepresentation::Kind::Unidentified)
104-
fail = true;
105-
});
106-
return fail;
107-
}
108-
109-
bool mayLoadWeakOrUnowned(SILInstruction *instruction) {
110-
// TODO: It is possible to do better here by looking at the address that is
111-
// being loaded.
112-
return isa<LoadWeakInst>(instruction) || isa<LoadUnownedInst>(instruction);
113-
}
114-
115-
bool isDeinitBarrier(SILInstruction *instruction) {
116-
return isBarrierApply(instruction) || instruction->maySynchronize() ||
117-
mayAccessPointer(instruction) || mayLoadWeakOrUnowned(instruction);
118-
}
119-
12091
bool canReplaceValueWithBorrowee(SILValue value) {
12192
while (true) {
12293
auto *instruction = value.getDefiningInstruction();

0 commit comments

Comments
 (0)