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

Piyou Chen via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 03:01:05 PDT 2024


================
@@ -1502,14 +1668,14 @@ void RISCVInsertVSETVLI::doPRE(MachineBasicBlock &MBB) {
   // we need to prove the value is available at the point we're going
   // to insert the vsetvli at.
   if (AvailableInfo.hasAVLReg()) {
-    const MachineInstr *AVLDefMI = &AvailableInfo.getAVLDefMI();
+    SlotIndex SI = AvailableInfo.getAVLVNInfo()->def;
     // This is an inline dominance check which covers the case of
     // UnavailablePred being the preheader of a loop.
-    if (AVLDefMI->getParent() != UnavailablePred)
+    if (LIS->getMBBFromIndex(SI) != UnavailablePred)
----------------
BeMg wrote:

Yes. pre-ra and post-ra vsetvli pass major different is SSA form or non-SSA form. It is also why I use the `MRI.isSSA()` to select the pre-ra path inside `needVSETVLPHI` now.

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


More information about the llvm-commits mailing list