Skip to content

Commit 06575b4

Browse files
committed
Revert "[LegalizeTypes] Use UpdateNodeOperands in SoftPromoteHalfOp_STACKMAP/PATCHPOINT. (#165927)"
This reverts commit 4357fcb. Causes a crash when combined with #165922.
1 parent 02fef97 commit 06575b4

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,14 +3977,28 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfOp_ATOMIC_STORE(SDNode *N,
39773977
SDValue DAGTypeLegalizer::SoftPromoteHalfOp_STACKMAP(SDNode *N, unsigned OpNo) {
39783978
assert(OpNo > 1); // Because the first two arguments are guaranteed legal.
39793979
SmallVector<SDValue> NewOps(N->ops());
3980-
NewOps[OpNo] = GetSoftPromotedHalf(NewOps[OpNo]);
3981-
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
3980+
SDValue Op = N->getOperand(OpNo);
3981+
NewOps[OpNo] = GetSoftPromotedHalf(Op);
3982+
SDValue NewNode =
3983+
DAG.getNode(N->getOpcode(), SDLoc(N), N->getVTList(), NewOps);
3984+
3985+
for (unsigned ResNum = 0; ResNum < N->getNumValues(); ResNum++)
3986+
ReplaceValueWith(SDValue(N, ResNum), NewNode.getValue(ResNum));
3987+
3988+
return SDValue(); // Signal that we replaced the node ourselves.
39823989
}
39833990

39843991
SDValue DAGTypeLegalizer::SoftPromoteHalfOp_PATCHPOINT(SDNode *N,
39853992
unsigned OpNo) {
39863993
assert(OpNo >= 7);
39873994
SmallVector<SDValue> NewOps(N->ops());
3988-
NewOps[OpNo] = GetSoftPromotedHalf(NewOps[OpNo]);
3989-
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
3995+
SDValue Op = N->getOperand(OpNo);
3996+
NewOps[OpNo] = GetSoftPromotedHalf(Op);
3997+
SDValue NewNode =
3998+
DAG.getNode(N->getOpcode(), SDLoc(N), N->getVTList(), NewOps);
3999+
4000+
for (unsigned ResNum = 0; ResNum < N->getNumValues(); ResNum++)
4001+
ReplaceValueWith(SDValue(N, ResNum), NewNode.getValue(ResNum));
4002+
4003+
return SDValue(); // Signal that we replaced the node ourselves.
39904004
}

0 commit comments

Comments
 (0)