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 {
2367
2367
// / Return the storageAddress if \p value is opaque, otherwise create and
2368
2368
// / return a stack temporary.
2369
2369
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
+ }
2372
2375
2373
2376
// Create a stack temporary for a loadable value
2374
2377
auto *addr = termBuilder.createAllocStack (castLoc, value->getType ());
@@ -2593,14 +2596,12 @@ class UseRewriter : SILInstructionVisitor<UseRewriter> {
2593
2596
}
2594
2597
2595
2598
void visitYieldInst (YieldInst *yield) {
2596
- SILValue addr =
2597
- pass.valueStorageMap .getStorage (yield->getOperand (0 )).storageAddress ;
2599
+ SILValue addr = addrMat.materializeAddress (use->get ());
2598
2600
yield->setOperand (0 , addr);
2599
2601
}
2600
2602
2601
2603
void visitValueMetatypeInst (ValueMetatypeInst *vmi) {
2602
- auto opAddr =
2603
- pass.valueStorageMap .getStorage (vmi->getOperand ()).storageAddress ;
2604
+ SILValue opAddr = addrMat.materializeAddress (use->get ());
2604
2605
vmi->setOperand (opAddr);
2605
2606
}
2606
2607
You can’t perform that action at this time.
0 commit comments