[llvm] [RISCV] Extend redundant vrgather.vx peephole to vfmv.v.f (PR #135503)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 14 18:13:07 PDT 2025


================
@@ -19716,10 +19716,15 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
     SDValue Src = N->getOperand(0);
     SDValue Passthru = N->getOperand(2);
     SDValue VL = N->getOperand(4);
-    // TODO: Handle fmv.v.f?
-    if (Src.getOpcode() == RISCVISD::VMV_V_X_VL && Passthru.isUndef() &&
-        VL == Src.getOperand(2))
-      return Src;
+    switch (Src.getOpcode()) {
+    default:
+      break;
+    case RISCVISD::VMV_V_X_VL:
+    case RISCVISD::VFMV_V_F_VL:
+      if (Passthru.isUndef() && VL == Src.getOperand(2))
+        return Src;
----------------
preames wrote:

We can definitely generalize this in a couple dimensions.  I'm trying to make sure I have test coverage for everything I add, and haven't seen your suggested variant.  Feel free to check in a test case if you have one.  

https://github.com/llvm/llvm-project/pull/135503


More information about the llvm-commits mailing list