[llvm] [RISCV] Support postRA vsetvl insertion pass (PR #70549)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 30 06:25:14 PDT 2024


================
@@ -1705,11 +1875,16 @@ void RISCVInsertVSETVLI::insertReadVL(MachineBasicBlock &MBB) {
     MachineInstr &MI = *I++;
     if (RISCV::isFaultFirstLoad(MI)) {
       Register VLOutput = MI.getOperand(1).getReg();
-      if (!MRI->use_nodbg_empty(VLOutput))
-        BuildMI(MBB, I, MI.getDebugLoc(), TII->get(RISCV::PseudoReadVL),
-                VLOutput);
+      bool IsVirtual = MI.getOperand(1).getReg().isVirtual();
----------------
lukel97 wrote:

I checked out this PR and took a look, it's always virtual when we run it before regalloc. But it becomes physical whenever we run it with `-riscv-vsetvli-after-rvv-regalloc`? I'm confused as to why doing it post vector regalloc would change the AVL registers. 

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


More information about the llvm-commits mailing list