@@ -36,7 +36,7 @@ void StackNesting::setup() {
36
36
BlockInfo &BI = BlockInfos[Block];
37
37
for (SILInstruction &I : *Block) {
38
38
if (I.isAllocatingStack ()) {
39
- auto Alloc = cast<SingleValueInstruction>(&I) ;
39
+ auto Alloc = &I ;
40
40
// Register this stack location.
41
41
unsigned CurrentBitNumber = StackLocs.size ();
42
42
StackLoc2BitNumbers[Alloc] = CurrentBitNumber;
@@ -201,7 +201,7 @@ bool StackNesting::solve() {
201
201
return isNested;
202
202
}
203
203
204
- static SILInstruction *createDealloc (SingleValueInstruction *Alloc,
204
+ static SILInstruction *createDealloc (SILInstruction *Alloc,
205
205
SILInstruction *InsertionPoint,
206
206
SILLocation Location) {
207
207
SILBuilderWithScope B (InsertionPoint);
@@ -211,13 +211,14 @@ static SILInstruction *createDealloc(SingleValueInstruction *Alloc,
211
211
assert ((isa<AllocStackInst>(Alloc) ||
212
212
cast<PartialApplyInst>(Alloc)->isOnStack ()) &&
213
213
" wrong instruction" );
214
- return B.createDeallocStack (Location, Alloc);
214
+ return B.createDeallocStack (Location,
215
+ cast<SingleValueInstruction>(Alloc));
215
216
case SILInstructionKind::AllocRefDynamicInst:
216
217
case SILInstructionKind::AllocRefInst:
217
218
assert (cast<AllocRefInstBase>(Alloc)->canAllocOnStack ());
218
- return B.createDeallocStackRef (Location, Alloc);
219
+ return B.createDeallocStackRef (Location, cast<AllocRefInstBase>( Alloc) );
219
220
case SILInstructionKind::AllocPackInst:
220
- return B.createDeallocPack (Location, Alloc);
221
+ return B.createDeallocPack (Location, cast<AllocPackInst>( Alloc) );
221
222
default :
222
223
llvm_unreachable (" unknown stack allocation" );
223
224
}
@@ -368,7 +369,7 @@ void StackNesting::dump() const {
368
369
llvm::dbgs () << ' \n ' ;
369
370
for (SILInstruction *StackInst : bd.data .StackInsts ) {
370
371
if (StackInst->isAllocatingStack ()) {
371
- auto AllocInst = cast<SingleValueInstruction>( StackInst) ;
372
+ auto AllocInst = StackInst;
372
373
int BitNr = StackLoc2BitNumbers.lookup (AllocInst);
373
374
llvm::dbgs () << " alloc #" << BitNr << " : alive=" ;
374
375
dumpBits (StackLocs[BitNr].AliveLocs );
0 commit comments