aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFraser Cormack <fraser@codeplay.com>2020-12-08 09:20:28 +0000
committerFraser Cormack <fraser@codeplay.com>2020-12-09 09:35:28 +0000
commitaf5fd658952a7f1d9d2a1007217755bd04b4dd4e (patch)
tree55dd2e65de134a8be424037015811063e965b007
parent13e4e5ed59c92d81ee5fee55f20ecf1842ec8cf3 (diff)
downloadllvm-project-af5fd658952a7f1d9d2a1007217755bd04b4dd4e.tar.gz
[RISCV] Fix missing def operand when creating VSETVLI pseudos
The register operand was not being marked as a def when it should be. No tests for this in the main branch as there are not yet any pseudos without a non-negative VLIndex. Also change the type of a virtual register operand from unsigned to Register and adjust formatting. Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D92823
-rw-r--r--llvm/lib/Target/RISCV/RISCVISelLowering.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 2c2ae54dbd59..c58d44771f50 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1942,13 +1942,13 @@ static MachineBasicBlock *addVSetVL(MachineInstr &MI, MachineBasicBlock *BB,
if (VLIndex >= 0) {
// Set VL (rs1 != X0).
- unsigned DestReg = MRI.createVirtualRegister(&RISCV::GPRRegClass);
+ Register DestReg = MRI.createVirtualRegister(&RISCV::GPRRegClass);
MIB.addReg(DestReg, RegState::Define | RegState::Dead)
- .addReg(MI.getOperand(VLIndex).getReg());
+ .addReg(MI.getOperand(VLIndex).getReg());
} else
// With no VL operator in the pseudo, do not modify VL (rd = X0, rs1 = X0).
- MIB.addReg(RISCV::X0, RegState::Dead)
- .addReg(RISCV::X0, RegState::Kill);
+ MIB.addReg(RISCV::X0, RegState::Define | RegState::Dead)
+ .addReg(RISCV::X0, RegState::Kill);
// For simplicity we reuse the vtype representation here.
MIB.addImm(RISCVVType::encodeVTYPE(Multiplier, ElementWidth,