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) {
1650
1650
}
1651
1651
}
1652
1652
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
+
1653
1668
// / An address, pointer, or box cast that occurs outside of the formal
1654
1669
// / access. These convert the base of accessed storage without affecting the
1655
1670
// / 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) {
2379
2379
if (moveChecker.canonicalizer .foundAnyConsumingUses ()) {
2380
2380
LLVM_DEBUG (llvm::dbgs ()
2381
2381
<< " Found mark must check [nocopy] error: " << *user);
2382
- auto operand = stripAccessMarkers (markedValue->getOperand ());
2382
+ auto operand = stripAccessAndIdentityCasts (markedValue->getOperand ());
2383
2383
auto *fArg = dyn_cast<SILFunctionArgument>(operand);
2384
2384
auto *ptrToAddr = dyn_cast<PointerToAddressInst>(operand);
2385
2385
You can’t perform that action at this time.
0 commit comments