[PATCH] D122769: [RISCV] Add a prepass to vsetvli insertion to propagate VLMAX vsetvli to the instructions.
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 7 07:42:37 PDT 2022
reames added a comment.
I played around with this a bit last night and realized you can achieve the same effect with a small change inside insertVSETVLI. I also implemented a simple version of the post-pass, and getting that to cover your case of interest turns out to be difficult as you also need the cross block reasoning.
@@ -682,6 +705,16 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB,
return;
}
+
+ if (AVLReg.isVirtual()) {
+ MachineInstr &DefMI = *MRI->getVRegDef(AVLReg);
+ if (isVLMaxVSETVLI(DefMI)) {
+ VSETVLIInfo DefInfo = getInfoForVSETVLI(DefMI);
+ if (Info.hasSameVLMAX(DefInfo))
+ AVLReg = RISCV::X0;
+ }
+ }
if (AVLReg.isVirtual())
MRI->constrainRegClass(AVLReg, &RISCV::GPRNoX0RegClass);
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122769/new/
https://reviews.llvm.org/D122769
More information about the llvm-commits
mailing list