[llvm] [RISCV] Prefer whole register loads and stores when VL=VLMAX (PR #75531)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 13:48:39 PST 2024
================
@@ -9882,12 +9895,22 @@ RISCVTargetLowering::lowerFixedLengthVectorStoreToRVV(SDValue Op,
MVT ContainerVT = getContainerForFixedLengthVector(VT);
- SDValue VL = getVLOp(VT.getVectorNumElements(), ContainerVT, DL, DAG,
- Subtarget);
-
SDValue NewValue =
convertToScalableVector(ContainerVT, StoreVal, DAG, Subtarget);
+
+ // If we know the exact VLEN and our fixed length vector completely fills
+ // the container, use a whole register store instead.
+ const auto [MinVLMAX, MaxVLMAX] =
+ RISCVTargetLowering::computeVLMAXBounds(ContainerVT, Subtarget);
+ if (MinVLMAX == MaxVLMAX && MinVLMAX == VT.getVectorNumElements() &&
+ getLMUL1VT(ContainerVT).bitsLE(ContainerVT))
+ return DAG.getStore(Store->getChain(), DL, NewValue, Store->getBasePtr(),
+ Store->getMemOperand());
----------------
preames wrote:
I'm wondering if the problem is the memory type in the memory operand. We leave a fixed size memory operand in place for a whole register (i.e. scalable?) store. Maybe this confuses something in AA? I don't think this is wrong per se, but it might be surprising.
https://github.com/llvm/llvm-project/pull/75531
More information about the llvm-commits
mailing list