[llvm] 5fb3311 - [RISCV] Use uint32_t for NumOfVReg in getVLENFactoredAmount. (#84110)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 5 20:59:11 PST 2024
Author: Craig Topper
Date: 2024-03-05T20:59:07-08:00
New Revision: 5fb331106dbcfba21f82b2a84c22a65ee9d4d014
URL: https://github.com/llvm/llvm-project/commit/5fb331106dbcfba21f82b2a84c22a65ee9d4d014
DIFF: https://github.com/llvm/llvm-project/commit/5fb331106dbcfba21f82b2a84c22a65ee9d4d014.diff
LOG: [RISCV] Use uint32_t for NumOfVReg in getVLENFactoredAmount. (#84110)
The rest of the code pretty much assumed this anyway.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 2abe015c9f9cdc..ef0d7cbc835d0d 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -3059,11 +3059,11 @@ void RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
"Reserve the stack by the multiple of one vector size.");
MachineRegisterInfo &MRI = MF.getRegInfo();
- int64_t NumOfVReg = Amount / 8;
+ assert(isInt<32>(Amount / 8) &&
+ "Expect the number of vector registers within 32-bits.");
+ uint32_t NumOfVReg = Amount / 8;
BuildMI(MBB, II, DL, get(RISCV::PseudoReadVLENB), DestReg).setMIFlag(Flag);
- assert(isInt<32>(NumOfVReg) &&
- "Expect the number of vector registers within 32-bits.");
if (llvm::has_single_bit<uint32_t>(NumOfVReg)) {
uint32_t ShiftAmount = Log2_32(NumOfVReg);
if (ShiftAmount == 0)
@@ -3137,7 +3137,7 @@ void RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
.setMIFlag(Flag);
uint32_t PrevShiftAmount = 0;
for (uint32_t ShiftAmount = 0; NumOfVReg >> ShiftAmount; ShiftAmount++) {
- if (NumOfVReg & (1LL << ShiftAmount)) {
+ if (NumOfVReg & (1U << ShiftAmount)) {
if (ShiftAmount)
BuildMI(MBB, II, DL, get(RISCV::SLLI), DestReg)
.addReg(DestReg, RegState::Kill)
More information about the llvm-commits
mailing list