[llvm] 18ed2ee - [RISCV] Add a version of insertVSETVLI which uses an iterator [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 14:48:46 PDT 2022
Author: Philip Reames
Date: 2022-05-04T14:48:31-07:00
New Revision: 18ed2ee80c540d8b9c389d3722c70f89593c2b44
URL: https://github.com/llvm/llvm-project/commit/18ed2ee80c540d8b9c389d3722c70f89593c2b44
DIFF: https://github.com/llvm/llvm-project/commit/18ed2ee80c540d8b9c389d3722c70f89593c2b44.diff
LOG: [RISCV] Add a version of insertVSETVLI which uses an iterator [NFC]
This is to simplify the final version of D124869.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index f08dbeeb8d019..304d1c3bf0cf2 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -473,6 +473,9 @@ class RISCVInsertVSETVLI : public MachineFunctionPass {
bool needVSETVLIPHI(const VSETVLIInfo &Require, const MachineBasicBlock &MBB);
void insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
const VSETVLIInfo &Info, const VSETVLIInfo &PrevInfo);
+ void insertVSETVLI(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator InsertPt, DebugLoc DL,
+ const VSETVLIInfo &Info, const VSETVLIInfo &PrevInfo);
bool computeVLVTYPEChanges(const MachineBasicBlock &MBB);
void computeIncomingVLVTYPE(const MachineBasicBlock &MBB);
@@ -627,12 +630,18 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
const VSETVLIInfo &Info,
const VSETVLIInfo &PrevInfo) {
DebugLoc DL = MI.getDebugLoc();
+ insertVSETVLI(MBB, MachineBasicBlock::iterator(&MI), DL, Info, PrevInfo);
+}
+
+void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator InsertPt, DebugLoc DL,
+ const VSETVLIInfo &Info, const VSETVLIInfo &PrevInfo) {
// Use X0, X0 form if the AVL is the same and the SEW+LMUL gives the same
// VLMAX.
if (PrevInfo.isValid() && !PrevInfo.isUnknown() &&
Info.hasSameAVL(PrevInfo) && Info.hasSameVLMAX(PrevInfo)) {
- BuildMI(MBB, MI, DL, TII->get(RISCV::PseudoVSETVLIX0))
+ BuildMI(MBB, InsertPt, DL, TII->get(RISCV::PseudoVSETVLIX0))
.addReg(RISCV::X0, RegState::Define | RegState::Dead)
.addReg(RISCV::X0, RegState::Kill)
.addImm(Info.encodeVTYPE())
@@ -641,7 +650,7 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
}
if (Info.hasAVLImm()) {
- BuildMI(MBB, MI, DL, TII->get(RISCV::PseudoVSETIVLI))
+ BuildMI(MBB, InsertPt, DL, TII->get(RISCV::PseudoVSETIVLI))
.addReg(RISCV::X0, RegState::Define | RegState::Dead)
.addImm(Info.getAVLImm())
.addImm(Info.encodeVTYPE());
@@ -654,7 +663,7 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
// the previous vl to become invalid.
if (PrevInfo.isValid() && !PrevInfo.isUnknown() &&
Info.hasSameVLMAX(PrevInfo)) {
- BuildMI(MBB, MI, DL, TII->get(RISCV::PseudoVSETVLIX0))
+ BuildMI(MBB, InsertPt, DL, TII->get(RISCV::PseudoVSETVLIX0))
.addReg(RISCV::X0, RegState::Define | RegState::Dead)
.addReg(RISCV::X0, RegState::Kill)
.addImm(Info.encodeVTYPE())
@@ -662,7 +671,7 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
return;
}
// Otherwise use an AVL of 0 to avoid depending on previous vl.
- BuildMI(MBB, MI, DL, TII->get(RISCV::PseudoVSETIVLI))
+ BuildMI(MBB, InsertPt, DL, TII->get(RISCV::PseudoVSETIVLI))
.addReg(RISCV::X0, RegState::Define | RegState::Dead)
.addImm(0)
.addImm(Info.encodeVTYPE());
@@ -681,7 +690,7 @@ void RISCVInsertVSETVLI::insertVSETVLI(MachineBasicBlock &MBB, MachineInstr &MI,
DestReg = MRI->createVirtualRegister(&RISCV::GPRRegClass);
Opcode = RISCV::PseudoVSETVLIX0;
}
- BuildMI(MBB, MI, DL, TII->get(Opcode))
+ BuildMI(MBB, InsertPt, DL, TII->get(Opcode))
.addReg(DestReg, RegState::Define | RegState::Dead)
.addReg(AVLReg)
.addImm(Info.encodeVTYPE());
More information about the llvm-commits
mailing list