[llvm] d0878f1 - [RISCV] Use RVVBitsPerBlock in assignRVVStackObjectOffsets and adjustReg. NFC (#109848)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 21:36:58 PDT 2024
Author: Craig Topper
Date: 2024-09-24T21:36:55-07:00
New Revision: d0878f13dffa406a267eb8d0b64f803951e997ea
URL: https://github.com/llvm/llvm-project/commit/d0878f13dffa406a267eb8d0b64f803951e997ea
DIFF: https://github.com/llvm/llvm-project/commit/d0878f13dffa406a267eb8d0b64f803951e997ea.diff
LOG: [RISCV] Use RVVBitsPerBlock in assignRVVStackObjectOffsets and adjustReg. NFC (#109848)
I think the 8 here represents RVVBitsPerBlock / 8.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 7abd5a49a1b5fc..22824b77c37dd6 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -1090,11 +1090,12 @@ RISCVFrameLowering::assignRVVStackObjectOffsets(MachineFunction &MF) const {
for (int FI : ObjectsToAllocate) {
// ObjectSize in bytes.
int64_t ObjectSize = MFI.getObjectSize(FI);
- auto ObjectAlign = std::max(Align(8), MFI.getObjectAlign(FI));
+ auto ObjectAlign =
+ std::max(Align(RISCV::RVVBitsPerBlock / 8), MFI.getObjectAlign(FI));
// If the data type is the fractional vector type, reserve one vector
// register for it.
- if (ObjectSize < 8)
- ObjectSize = 8;
+ if (ObjectSize < (RISCV::RVVBitsPerBlock / 8))
+ ObjectSize = (RISCV::RVVBitsPerBlock / 8);
Offset = alignTo(Offset + ObjectSize, ObjectAlign);
MFI.setObjectOffset(FI, -Offset);
// Update the maximum alignment of the RVV stack section
diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
index 701594c0fb05dc..91d539a355ac25 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
@@ -200,11 +200,11 @@ void RISCVRegisterInfo::adjustReg(MachineBasicBlock &MBB,
ScratchReg = MRI.createVirtualRegister(&RISCV::GPRRegClass);
assert(ScalableValue > 0 && "There is no need to get VLEN scaled value.");
- assert(ScalableValue % 8 == 0 &&
+ assert(ScalableValue % (RISCV::RVVBitsPerBlock / 8) == 0 &&
"Reserve the stack by the multiple of one vector size.");
- assert(isInt<32>(ScalableValue / 8) &&
+ assert(isInt<32>(ScalableValue / (RISCV::RVVBitsPerBlock / 8)) &&
"Expect the number of vector registers within 32-bits.");
- uint32_t NumOfVReg = ScalableValue / 8;
+ uint32_t NumOfVReg = ScalableValue / (RISCV::RVVBitsPerBlock / 8);
BuildMI(MBB, II, DL, TII->get(RISCV::PseudoReadVLENB), ScratchReg)
.setMIFlag(Flag);
More information about the llvm-commits
mailing list