[llvm] [RISCV] Clear vill for whole vector register moves in vsetvli insertion (PR #118283)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 10:35:21 PST 2024


================
@@ -1208,6 +1232,17 @@ static VSETVLIInfo adjustIncoming(VSETVLIInfo PrevInfo, VSETVLIInfo NewInfo,
 // legal for MI, but may not be the state requested by MI.
 void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
                                         const MachineInstr &MI) const {
+  if (isVectorCopy(ST->getRegisterInfo(), MI) &&
+      (Info.isUnknown() || !Info.isValid() || Info.hasSEWLMULRatioOnly())) {
+    // Use an arbitrary but valid AVL and VTYPE so vill will be cleared. It may
+    // be coalesced into another vsetvli since we won't demand any fields.
+    VSETVLIInfo NewInfo; // Need a new VSETVLIInfo to clear SEWLMULRatioOnly
+    NewInfo.setAVLImm(1);
+    NewInfo.setVTYPE(RISCVII::VLMUL::LMUL_1, 8, true, true);
----------------
topperc wrote:

Can you add comment labels for the 8 and `true` values here.

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


More information about the llvm-commits mailing list