File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -663,15 +663,15 @@ void MemoryToRegisters::removeSingleBlockAllocation(AllocStackInst *ASI) {
663
663
}
664
664
665
665
// Remove dead address instructions that may be uses of the allocation.
666
- SILNode *Node = Inst;
667
- while (isa<StructElementAddrInst>(Node) ||
668
- isa<TupleElementAddrInst>(Node) ||
669
- isa<UncheckedAddrCastInst>(Node)) {
670
- auto *I = cast<SingleValueInstruction>(Node);
671
- if (!I->use_empty ()) break ;
672
- Node = I->getOperand (0 );
673
- I->eraseFromParent ();
666
+ auto *addrInst = dyn_cast<SingleValueInstruction>(Inst);
667
+ while (addrInst && addrInst->use_empty () &&
668
+ (isa<StructElementAddrInst>(addrInst) ||
669
+ isa<TupleElementAddrInst>(addrInst) ||
670
+ isa<UncheckedAddrCastInst>(addrInst))) {
671
+ SILValue op = addrInst->getOperand (0 );
672
+ addrInst->eraseFromParent ();
674
673
++NumInstRemoved;
674
+ addrInst = dyn_cast<SingleValueInstruction>(op);
675
675
}
676
676
}
677
677
}
You can’t perform that action at this time.
0 commit comments