Skip to content

[SelectionDAG] Fix the assertion failure in Release build after #91747 #93416

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 6 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11293,10 +11293,12 @@ void SelectionDAG::ReplaceAllUsesWith(SDNode *From, const SDValue *To) {
return ReplaceAllUsesWith(SDValue(From, 0), To[0]);

for (unsigned i = 0, e = From->getNumValues(); i != e; ++i) {
// Preserve Debug Info.
transferDbgValues(SDValue(From, i), To[i]);
// Preserve extra info.
copyExtraInfo(From, To[i].getNode());
if (From->hasAnyUseOfValue(i)) {
// Preserve Debug Info.
transferDbgValues(SDValue(From, i), To[i]);
// Preserve extra info.
copyExtraInfo(From, To[i].getNode());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you're reading uninitialized memory here. The number of results must match exactly, which is not true when you're replacing (i8, i32) with just (i32).

}
}

// Iterate over just the existing users of From. See the comments in
Expand Down
Loading