[llvm] [RISCV] Shrink vslideup's LMUL when lowering fixed insert_subvector (PR #65997)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 26 23:23:51 PDT 2023


topperc wrote:

I think we're starting to see failures from this change. This fixes the failures I've seen, but I think there may be some ordering issues with when we decide to shrink. If we enter this particular `if` it doesn't seem like we should have done any shrinking in the first place.

```
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index c4942f9c637b..ee9957795f97 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -8641,6 +8641,9 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
                          DAG.getUNDEF(ContainerVT), SubVec,
                          DAG.getConstant(0, DL, XLenVT));
     if (OrigIdx == 0 && Vec.isUndef() && VecVT.isFixedLengthVector()) {
+      if (ContainerVT != OrigContainerVT)
+        SubVec = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, OrigContainerVT, OrigVec,
+                             SubVec, DAG.getVectorIdxConstant(0, DL));
       SubVec = convertFromScalableVector(VecVT, SubVec, DAG, Subtarget);
       return DAG.getBitcast(Op.getValueType(), SubVec);
     }
```

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


More information about the llvm-commits mailing list