File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1650,6 +1650,21 @@ inline bool isAccessStorageIdentityCast(SingleValueInstruction *svi) {
16501650 }
16511651}
16521652
1653+ // Strip access markers and casts that preserve the address type.
1654+ //
1655+ // Consider using RelativeAccessStorageWithBase::compute().
1656+ inline SILValue stripAccessAndIdentityCasts (SILValue v) {
1657+ if (auto *bai = dyn_cast<BeginAccessInst>(v)) {
1658+ return stripAccessAndIdentityCasts (bai->getOperand ());
1659+ }
1660+ if (auto *svi = dyn_cast<SingleValueInstruction>(v)) {
1661+ if (isAccessStorageIdentityCast (svi)) {
1662+ return stripAccessAndIdentityCasts (svi->getAllOperands ()[0 ].get ());
1663+ }
1664+ }
1665+ return v;
1666+ }
1667+
16531668// / An address, pointer, or box cast that occurs outside of the formal
16541669// / access. These convert the base of accessed storage without affecting the
16551670// / AccessPath. Useful for both use-def and def-use traversal. The source
Original file line number Diff line number Diff line change @@ -2379,7 +2379,7 @@ bool GatherUsesVisitor::visitUse(Operand *op) {
23792379 if (moveChecker.canonicalizer .foundAnyConsumingUses ()) {
23802380 LLVM_DEBUG (llvm::dbgs ()
23812381 << " Found mark must check [nocopy] error: " << *user);
2382- auto operand = stripAccessMarkers (markedValue->getOperand ());
2382+ auto operand = stripAccessAndIdentityCasts (markedValue->getOperand ());
23832383 auto *fArg = dyn_cast<SILFunctionArgument>(operand);
23842384 auto *ptrToAddr = dyn_cast<PointerToAddressInst>(operand);
23852385
You can’t perform that action at this time.
0 commit comments