Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/SIL/IR/SILInstruction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down