Skip to content

Commit 5fb3311

Browse files
authored
[RISCV] Use uint32_t for NumOfVReg in getVLENFactoredAmount. (#84110)
The rest of the code pretty much assumed this anyway.
1 parent 7bad74e commit 5fb3311

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3059,11 +3059,11 @@ void RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
30593059
"Reserve the stack by the multiple of one vector size.");
30603060

30613061
MachineRegisterInfo &MRI = MF.getRegInfo();
3062-
int64_t NumOfVReg = Amount / 8;
3062+
assert(isInt<32>(Amount / 8) &&
3063+
"Expect the number of vector registers within 32-bits.");
3064+
uint32_t NumOfVReg = Amount / 8;
30633065

30643066
BuildMI(MBB, II, DL, get(RISCV::PseudoReadVLENB), DestReg).setMIFlag(Flag);
3065-
assert(isInt<32>(NumOfVReg) &&
3066-
"Expect the number of vector registers within 32-bits.");
30673067
if (llvm::has_single_bit<uint32_t>(NumOfVReg)) {
30683068
uint32_t ShiftAmount = Log2_32(NumOfVReg);
30693069
if (ShiftAmount == 0)
@@ -3137,7 +3137,7 @@ void RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
31373137
.setMIFlag(Flag);
31383138
uint32_t PrevShiftAmount = 0;
31393139
for (uint32_t ShiftAmount = 0; NumOfVReg >> ShiftAmount; ShiftAmount++) {
3140-
if (NumOfVReg & (1LL << ShiftAmount)) {
3140+
if (NumOfVReg & (1U << ShiftAmount)) {
31413141
if (ShiftAmount)
31423142
BuildMI(MBB, II, DL, get(RISCV::SLLI), DestReg)
31433143
.addReg(DestReg, RegState::Kill)

0 commit comments

Comments
 (0)