Skip to content

Commit 2768e60

Browse files
committed
Fix MoveOnlyTypeChecker to handle address taking instructions
address_to_pointer and fix_lifetime (cherry picked from commit 43e88fd)
1 parent 3d7cdb9 commit 2768e60

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,6 +2449,17 @@ bool GatherUsesVisitor::visitUse(Operand *op) {
24492449
return true;
24502450
}
24512451

2452+
if (auto *fixLifetime = dyn_cast<FixLifetimeInst>(op->getUser())) {
2453+
auto leafRange = TypeTreeLeafTypeRange::get(op->get(), getRootAddress());
2454+
if (!leafRange) {
2455+
LLVM_DEBUG(llvm::dbgs() << "Failed to compute leaf range!\n");
2456+
return false;
2457+
}
2458+
2459+
useState.recordLivenessUse(user, *leafRange);
2460+
return true;
2461+
}
2462+
24522463
// If we don't fit into any of those categories, just track as a liveness
24532464
// use. We assume all such uses must only be reads to the memory. So we assert
24542465
// to be careful.

lib/SILOptimizer/Mandatory/MoveOnlyWrappedTypeEliminator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ struct SILMoveOnlyWrappedTypeEliminatorVisitor
199199
NO_UPDATE_NEEDED(BeginAccess)
200200
NO_UPDATE_NEEDED(EndAccess)
201201
NO_UPDATE_NEEDED(ClassMethod)
202+
NO_UPDATE_NEEDED(FixLifetime)
203+
NO_UPDATE_NEEDED(AddressToPointer)
202204
#undef NO_UPDATE_NEEDED
203205

204206
bool eliminateIdentityCast(SingleValueInstruction *svi) {

0 commit comments

Comments
 (0)