[llvm] ca0613e - [LegalizeFloatTypes] Handle replacement for strict ops inside SoftPromoteHalfOp_FP_TO_XINT. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 16:29:29 PDT 2024


Author: Craig Topper
Date: 2024-09-17T16:25:10-07:00
New Revision: ca0613e0fcef2a9972f2802318201f8272e74693

URL: https://github.com/llvm/llvm-project/commit/ca0613e0fcef2a9972f2802318201f8272e74693
DIFF: https://github.com/llvm/llvm-project/commit/ca0613e0fcef2a9972f2802318201f8272e74693.diff

LOG: [LegalizeFloatTypes] Handle replacement for strict ops inside SoftPromoteHalfOp_FP_TO_XINT. NFC

Return SDValue() so we can notify the caller we did all replacements.
Restore the getNumValues() == 1 check in the assert in the caller now
that all handles only return nodes with a single result.

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index 325aba461e808a..2c81c829e75cbb 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -3474,7 +3474,7 @@ bool DAGTypeLegalizer::SoftPromoteHalfOperand(SDNode *N, unsigned OpNo) {
 
   assert(Res.getNode() != N && "Expected a new node!");
 
-  assert(Res.getValueType() == N->getValueType(0) &&
+  assert(Res.getValueType() == N->getValueType(0) && N->getNumValues() == 1 &&
          "Invalid operand expansion");
 
   ReplaceValueWith(SDValue(N, 0), Res);
@@ -3544,7 +3544,8 @@ SDValue DAGTypeLegalizer::SoftPromoteHalfOp_FP_TO_XINT(SDNode *N) {
     Op = DAG.getNode(N->getOpcode(), dl, {RVT, MVT::Other},
                      {Op.getValue(1), Op});
     ReplaceValueWith(SDValue(N, 1), Op.getValue(1));
-    return Op;
+    ReplaceValueWith(SDValue(N, 0), Op);
+    return SDValue();
   }
 
   SDValue Res = DAG.getNode(GetPromotionOpcode(SVT, RVT), dl, NVT, Op);


        


More information about the llvm-commits mailing list