SIL: need to clear the bitfield ID when moving instructions between functions

I forgot to do this when introducing the `NodeBitfield`.

rdar://97095506
This commit is contained in:
Erik Eckstein
2022-07-21 14:35:03 +02:00
parent 023c9a0bf0
commit 3ae2889593

View File

@@ -77,12 +77,21 @@ transferNodesFromList(llvm::ilist_traits<SILInstruction> &L2,
// If transferring instructions within the same basic block, no reason to
// update their parent pointers.
SILBasicBlock *ThisParent = getContainingBlock();
if (ThisParent == L2.getContainingBlock()) return;
SILBasicBlock *l2Block = L2.getContainingBlock();
if (ThisParent == l2Block) return;
bool differentFunctions = (ThisParent->getFunction() != l2Block->getFunction());
// Update the parent fields in the instructions.
for (; first != last; ++first) {
SWIFT_FUNC_STAT_NAMED("sil");
first->ParentBB = ThisParent;
if (differentFunctions) {
for (SILValue result : first->getResults()) {
result->resetBitfields();
}
first->asSILNode()->resetBitfields();
}
}
}