Skip to content

Commit 3ae2889

Browse files
committed
SIL: need to clear the bitfield ID when moving instructions between functions
I forgot to do this when introducing the `NodeBitfield`. rdar://97095506
1 parent 023c9a0 commit 3ae2889

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/SIL/IR/SILInstruction.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,21 @@ transferNodesFromList(llvm::ilist_traits<SILInstruction> &L2,
7777
// If transferring instructions within the same basic block, no reason to
7878
// update their parent pointers.
7979
SILBasicBlock *ThisParent = getContainingBlock();
80-
if (ThisParent == L2.getContainingBlock()) return;
80+
SILBasicBlock *l2Block = L2.getContainingBlock();
81+
if (ThisParent == l2Block) return;
82+
83+
bool differentFunctions = (ThisParent->getFunction() != l2Block->getFunction());
8184

8285
// Update the parent fields in the instructions.
8386
for (; first != last; ++first) {
8487
SWIFT_FUNC_STAT_NAMED("sil");
8588
first->ParentBB = ThisParent;
89+
if (differentFunctions) {
90+
for (SILValue result : first->getResults()) {
91+
result->resetBitfields();
92+
}
93+
first->asSILNode()->resetBitfields();
94+
}
8695
}
8796
}
8897

0 commit comments

Comments
 (0)