Skip to content

[NVPTX] Remove incorrect elimination of CopyToReg #149379

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 2 commits into from
Closed
Show file tree
Hide file tree
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
14 changes: 1 addition & 13 deletions llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4979,8 +4979,6 @@ combineUnpackingMovIntoLoad(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
if (!NVPTX::isPackedVectorTy(ElementVT) || ElementVT == MVT::v4i8)
return SDValue();

SmallVector<SDNode *> DeadCopyToRegs;

// Check whether all outputs are either used by an extractelt or are
// glue/chain nodes
if (!all_of(N->uses(), [&](SDUse &U) {
Expand Down Expand Up @@ -5008,12 +5006,6 @@ combineUnpackingMovIntoLoad(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
return !U.getUser()->use_empty();
}

// Handle CopyToReg nodes that will become dead after our replacement
if (U.getUser()->getOpcode() == ISD::CopyToReg) {
DeadCopyToRegs.push_back(U.getUser());
return true;
}

// Otherwise, this use prevents us from splitting a value.
return false;
}))
Expand Down Expand Up @@ -5080,10 +5072,6 @@ combineUnpackingMovIntoLoad(SDNode *N, TargetLowering::DAGCombinerInfo &DCI) {
for (unsigned I : seq(NewLoad->getNumValues() - NewNumOutputs))
Results.push_back(NewLoad.getValue(NewNumOutputs + I));

// Remove dead CopyToReg nodes by folding them into the chain they reference
for (SDNode *CTR : DeadCopyToRegs)
DCI.CombineTo(CTR, CTR->getOperand(0));

return DCI.DAG.getMergeValues(Results, DL);
}

Expand Down Expand Up @@ -6420,4 +6408,4 @@ void NVPTXTargetLowering::computeKnownBitsForTargetNode(
default:
break;
}
}
}
591 changes: 346 additions & 245 deletions llvm/test/CodeGen/NVPTX/f16x2-instructions.ll

Large diffs are not rendered by default.

643 changes: 397 additions & 246 deletions llvm/test/CodeGen/NVPTX/f32x2-instructions.ll

Large diffs are not rendered by default.

Loading