[llvm] [RISCV] Prefer vsetivli for VLMAX when VLEN is exactly known (PR #75509)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 10:12:08 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 7537c3c452df36447719291bebc5589bdd5d1501 6b97bc1be41b1db3427fd6a1fa2d52cf25979a9a -- llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index 1aa35f1c64..32419fc148 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -807,7 +807,7 @@ static unsigned computeVLMAX(unsigned VLEN, unsigned SEW,
     VLEN = VLEN / LMul;
   else
     VLEN = VLEN * LMul;
-  return VLEN/SEW;
+  return VLEN / SEW;
 }
 
 static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
@@ -861,8 +861,7 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
           InstrInfo.setAVLImm(VLMAX);
         else
           InstrInfo.setAVLReg(RISCV::X0);
-      }
-      else
+      } else
         InstrInfo.setAVLImm(Imm);
     } else {
       InstrInfo.setAVLReg(VLOp.getReg());

``````````

</details>


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


More information about the llvm-commits mailing list