Skip to content

[SDAG] Set IsPostTypeLegalization flag in LegalizeDAG #122278

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
Jan 10, 2025
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: 3 additions & 8 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2153,6 +2153,7 @@ void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node,
EVT RetVT = Node->getValueType(0);
SmallVector<SDValue, 4> Ops(drop_begin(Node->ops()));
TargetLowering::MakeLibCallOptions CallOptions;
CallOptions.IsPostTypeLegalization = true;
// FIXME: This doesn't support tail calls.
std::pair<SDValue, SDValue> Tmp = TLI.makeLibCall(DAG, LC, RetVT,
Ops, CallOptions,
Expand Down Expand Up @@ -4342,6 +4343,8 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
LLVM_DEBUG(dbgs() << "Trying to convert node to libcall\n");
SmallVector<SDValue, 8> Results;
SDLoc dl(Node);
TargetLowering::MakeLibCallOptions CallOptions;
CallOptions.IsPostTypeLegalization = true;
// FIXME: Check flags on the node to see if we can use a finite call.
unsigned Opc = Node->getOpcode();
switch (Opc) {
Expand Down Expand Up @@ -4384,7 +4387,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
AtomicOrdering Order = cast<AtomicSDNode>(Node)->getMergedOrdering();
RTLIB::Libcall LC = RTLIB::getOUTLINE_ATOMIC(Opc, Order, VT);
EVT RetVT = Node->getValueType(0);
TargetLowering::MakeLibCallOptions CallOptions;
SmallVector<SDValue, 4> Ops;
if (TLI.getLibcallName(LC)) {
// If outline atomic available, prepare its arguments and expand.
Expand Down Expand Up @@ -4422,7 +4424,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
break;
}
case ISD::CLEAR_CACHE: {
TargetLowering::MakeLibCallOptions CallOptions;
SDValue InputChain = Node->getOperand(0);
SDValue StartVal = Node->getOperand(1);
SDValue EndVal = Node->getOperand(2);
Expand Down Expand Up @@ -4728,7 +4729,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
break;
case ISD::STRICT_BF16_TO_FP:
if (Node->getValueType(0) == MVT::f32) {
TargetLowering::MakeLibCallOptions CallOptions;
std::pair<SDValue, SDValue> Tmp = TLI.makeLibCall(
DAG, RTLIB::FPEXT_BF16_F32, MVT::f32, Node->getOperand(1),
CallOptions, SDLoc(Node), Node->getOperand(0));
Expand All @@ -4738,7 +4738,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
break;
case ISD::STRICT_FP16_TO_FP: {
if (Node->getValueType(0) == MVT::f32) {
TargetLowering::MakeLibCallOptions CallOptions;
std::pair<SDValue, SDValue> Tmp = TLI.makeLibCall(
DAG, RTLIB::FPEXT_F16_F32, MVT::f32, Node->getOperand(1), CallOptions,
SDLoc(Node), Node->getOperand(0));
Expand Down Expand Up @@ -4793,7 +4792,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
// Sign/zero extend the argument if the libcall takes a larger type.
SDValue Op = DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND, dl,
NVT, Node->getOperand(IsStrict ? 1 : 0));
TargetLowering::MakeLibCallOptions CallOptions;
CallOptions.setIsSigned(Signed);
std::pair<SDValue, SDValue> Tmp =
TLI.makeLibCall(DAG, LC, RVT, Op, CallOptions, dl, Chain);
Expand Down Expand Up @@ -4833,7 +4831,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unable to legalize as libcall");

SDValue Chain = IsStrict ? Node->getOperand(0) : SDValue();
TargetLowering::MakeLibCallOptions CallOptions;
std::pair<SDValue, SDValue> Tmp =
TLI.makeLibCall(DAG, LC, NVT, Op, CallOptions, dl, Chain);

Expand Down Expand Up @@ -4861,7 +4858,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
RTLIB::Libcall LC = RTLIB::getFPROUND(Op.getValueType(), VT);
assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unable to legalize as libcall");

TargetLowering::MakeLibCallOptions CallOptions;
std::pair<SDValue, SDValue> Tmp =
TLI.makeLibCall(DAG, LC, VT, Op, CallOptions, SDLoc(Node), Chain);
Results.push_back(Tmp.first);
Expand Down Expand Up @@ -4890,7 +4886,6 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {

assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unable to legalize as libcall");

TargetLowering::MakeLibCallOptions CallOptions;
std::pair<SDValue, SDValue> Tmp =
TLI.makeLibCall(DAG, LC, Node->getValueType(0), Node->getOperand(1),
CallOptions, SDLoc(Node), Node->getOperand(0));
Expand Down
Loading