File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
lib/SILOptimizer/Mandatory Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -2367,8 +2367,11 @@ class CheckedCastBrRewriter {
23672367 // / Return the storageAddress if \p value is opaque, otherwise create and
23682368 // / return a stack temporary.
23692369 SILValue getAddressForCastEntity (SILValue value, bool needsInit) {
2370- if (value->getType ().isAddressOnly (*func))
2371- return pass.valueStorageMap .getStorage (value).storageAddress ;
2370+ if (value->getType ().isAddressOnly (*func)) {
2371+ auto builder = pass.getBuilder (ccb->getIterator ());
2372+ AddressMaterialization addrMat (pass, builder);
2373+ return addrMat.materializeAddress (value);
2374+ }
23722375
23732376 // Create a stack temporary for a loadable value
23742377 auto *addr = termBuilder.createAllocStack (castLoc, value->getType ());
@@ -2593,14 +2596,12 @@ class UseRewriter : SILInstructionVisitor<UseRewriter> {
25932596 }
25942597
25952598 void visitYieldInst (YieldInst *yield) {
2596- SILValue addr =
2597- pass.valueStorageMap .getStorage (yield->getOperand (0 )).storageAddress ;
2599+ SILValue addr = addrMat.materializeAddress (use->get ());
25982600 yield->setOperand (0 , addr);
25992601 }
26002602
26012603 void visitValueMetatypeInst (ValueMetatypeInst *vmi) {
2602- auto opAddr =
2603- pass.valueStorageMap .getStorage (vmi->getOperand ()).storageAddress ;
2604+ SILValue opAddr = addrMat.materializeAddress (use->get ());
26042605 vmi->setOperand (opAddr);
26052606 }
26062607
You can’t perform that action at this time.
0 commit comments