[llvm] 84ee08c - [RISCV] Avoid illegal DAG combination for strict-fp nodes.

Yeting Kuo via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 2 19:29:37 PDT 2023


Author: Yeting Kuo
Date: 2023-06-03T10:29:30+08:00
New Revision: 84ee08c6a89a96c29e7be7e62f91f4bcdcde48ae

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

LOG: [RISCV] Avoid illegal DAG combination for strict-fp nodes.

Those combines may change the exception behavior and rounding behavior.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D151992

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 5e02f37534e57..d33c48397536a 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -11138,6 +11138,10 @@ static SDValue performFP_TO_INTCombine(SDNode *N,
 
   SDValue Src = N->getOperand(0);
 
+  // Don't do this for strict-fp Src.
+  if (Src->isStrictFPOpcode() || Src->isTargetStrictFPOpcode())
+    return SDValue();
+
   // Ensure the FP type is legal.
   if (!TLI.isTypeLegal(Src.getValueType()))
     return SDValue();
@@ -11237,6 +11241,10 @@ static SDValue performFP_TO_INT_SATCombine(SDNode *N,
 
   SDValue Src = N->getOperand(0);
 
+  // Don't do this for strict-fp Src.
+  if (Src->isStrictFPOpcode() || Src->isTargetStrictFPOpcode())
+    return SDValue();
+
   // Ensure the FP type is also legal.
   if (!TLI.isTypeLegal(Src.getValueType()))
     return SDValue();


        


More information about the llvm-commits mailing list