[llvm] 15b561e - [DAG] Move STEP_VECTOR constant fold from getNode to FoldConstantArithmetic

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 1 07:47:55 PDT 2023


Author: Simon Pilgrim
Date: 2023-09-01T15:47:37+01:00
New Revision: 15b561ed38a1ad695dd39a089f56ea5c6c1d6dc6

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

LOG: [DAG] Move STEP_VECTOR constant fold from getNode to FoldConstantArithmetic

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index b00b7a7f689627..58232a6fb8b0e5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5529,11 +5529,6 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
       if (VT == MVT::f128 && C->getValueType(0) == MVT::i128)
         return getConstantFP(APFloat(APFloat::IEEEquad(), Val), DL, VT);
       break;
-    case ISD::STEP_VECTOR: {
-      if (SDValue V = FoldSTEP_VECTOR(DL, VT, N1, *this))
-        return V;
-      break;
-    }
     }
   }
 
@@ -5585,7 +5580,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
   case ISD::CTLZ_ZERO_UNDEF:
   case ISD::CTTZ:
   case ISD::CTTZ_ZERO_UNDEF:
-  case ISD::CTPOP: {
+  case ISD::CTPOP:
+  case ISD::STEP_VECTOR: {
     SDValue Ops = {N1};
     if (SDValue Fold = FoldConstantArithmetic(Opcode, DL, VT, Ops))
       return Fold;
@@ -6103,6 +6099,10 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
                           APFloat::rmNearestTiesToEven, &Ignored);
         return getConstantFP(FPV, DL, VT);
       }
+      case ISD::STEP_VECTOR:
+        if (SDValue V = FoldSTEP_VECTOR(DL, VT, N1, *this))
+          return V;
+        break;
       }
     }
 


        


More information about the llvm-commits mailing list