[PATCH] D125812: [RISCV] Canonicalize AVL=setvli to AVL=Imm or AVL=VLMAX

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 11:23:08 PDT 2022


craig.topper accepted this revision.
craig.topper added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp:1265
+              VSETVLIInfo DefInfo = getInfoForVSETVLI(*DefMI);
+              if (DefInfo.hasSameVTYPE(Require) &&
+                  (DefInfo.hasAVLImm() || DefInfo.getAVLReg() == RISCV::X0)) {
----------------
reames wrote:
> reames wrote:
> > craig.topper wrote:
> > > craig.topper wrote:
> > > > Can this be hasSameVLMAX instead of hasSameVTYPE?
> > > Oh I guess that's what the TODO in the comment was. Is there any reason to not do that now?
> > Is HasSameVLMAX the same as "for all AVL, produce the same VL"?  
> > 
> > It seems like maybe it is, but I hadn't fully recognized that if so.  Probably needs a comment/name update.  
> If it is the same, I see at least three other places in code we can generalize.  With your permission, I'll do that in a separate change.  
The documentation for how VL is determined from AVL only mentions VLMAX. So I've been assuming that the calculation is independent of specific LMUL or SEW value and that only their relative ratio mattered.

We can do it separately.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125812/new/

https://reviews.llvm.org/D125812



More information about the llvm-commits mailing list