@@ -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;
@@ -178,7 +178,7 @@ bool StackNesting::solve() {
178
178
return isNested;
179
179
}
180
180
181
- static SILInstruction *createDealloc (SingleValueInstruction *Alloc,
181
+ static SILInstruction *createDealloc (SILInstruction *Alloc,
182
182
SILInstruction *InsertionPoint,
183
183
SILLocation Location) {
184
184
SILBuilderWithScope B (InsertionPoint);
@@ -188,13 +188,14 @@ static SILInstruction *createDealloc(SingleValueInstruction *Alloc,
188
188
assert ((isa<AllocStackInst>(Alloc) ||
189
189
cast<PartialApplyInst>(Alloc)->isOnStack ()) &&
190
190
" wrong instruction" );
191
- return B.createDeallocStack (Location, Alloc);
191
+ return B.createDeallocStack (Location,
192
+ cast<SingleValueInstruction>(Alloc));
192
193
case SILInstructionKind::AllocRefDynamicInst:
193
194
case SILInstructionKind::AllocRefInst:
194
195
assert (cast<AllocRefInstBase>(Alloc)->canAllocOnStack ());
195
- return B.createDeallocStackRef (Location, Alloc);
196
+ return B.createDeallocStackRef (Location, cast<AllocRefInstBase>( Alloc) );
196
197
case SILInstructionKind::AllocPackInst:
197
- return B.createDeallocPack (Location, Alloc);
198
+ return B.createDeallocPack (Location, cast<AllocPackInst>( Alloc) );
198
199
default :
199
200
llvm_unreachable (" unknown stack allocation" );
200
201
}
@@ -343,7 +344,7 @@ void StackNesting::dump() const {
343
344
llvm::dbgs () << ' \n ' ;
344
345
for (SILInstruction *StackInst : bd.data .StackInsts ) {
345
346
if (StackInst->isAllocatingStack ()) {
346
- auto AllocInst = cast<SingleValueInstruction>( StackInst) ;
347
+ auto AllocInst = StackInst;
347
348
int BitNr = StackLoc2BitNumbers.lookup (AllocInst);
348
349
llvm::dbgs () << " alloc #" << BitNr << " : alive=" ;
349
350
dumpBits (StackLocs[BitNr].AliveLocs );
0 commit comments