Skip to content

Commit 43e88fd

Browse files
committed
Fix MoveOnlyTypeChecker to handle address taking instructions
address_to_pointer and fix_lifetime
1 parent a345e57 commit 43e88fd

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
@@ -2448,6 +2448,17 @@ bool GatherUsesVisitor::visitUse(Operand *op) {
24482448
return true;
24492449
}
24502450

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