diff options
author | Philip Reames <preames@rivosinc.com> | 2025-03-26 18:25:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-26 18:25:59 -0700 |
commit | 79e82b6f146e39b2498b9eb44033cde8659ba6b7 (patch) | |
tree | 57e1c80a004bc70ebe9eb94e08af64000294195f /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | 88099a7da97b5ea5f12fb8c6c993d7f1b6fe06ce (diff) | |
download | llvm-79e82b6f146e39b2498b9eb44033cde8659ba6b7.zip llvm-79e82b6f146e39b2498b9eb44033cde8659ba6b7.tar.gz llvm-79e82b6f146e39b2498b9eb44033cde8659ba6b7.tar.bz2 |
[RISCV] Use a precise size for MMO on scalable spill and fill (#133171)
The primary effect of this is that we get proper scalable sizes printed
by the assembler, but this may also enable proper aliasing analysis. I
don't see any test changes resulting from the later.
Getting the size is slightly tricky as we store the scalable size as a
non-scalable quantity in the object size field for the frame index. We
really should remove that hack at some point...
For the synthetic tuple spills and fills, I dropped the size from the
split loads and stores to avoid incorrect (overly large) sizes. We could
also divide by the NF factor if we felt like writing the code to do so.
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 4716665..2409e60 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -2525,7 +2525,7 @@ using MMOList = SmallVector<const MachineMemOperand *, 2>; static LocationSize getSpillSlotSize(const MMOList &Accesses, const MachineFrameInfo &MFI) { - uint64_t Size = 0; + std::optional<TypeSize> Size; for (const auto *A : Accesses) { if (MFI.isSpillSlotObjectIndex( cast<FixedStackPseudoSourceValue>(A->getPseudoValue()) @@ -2533,10 +2533,15 @@ static LocationSize getSpillSlotSize(const MMOList &Accesses, LocationSize S = A->getSize(); if (!S.hasValue()) return LocationSize::beforeOrAfterPointer(); - Size += S.getValue(); + if (!Size) + Size = S.getValue(); + else + Size = *Size + S.getValue(); } } - return Size; + if (!Size) + return LocationSize::precise(0); + return LocationSize::precise(*Size); } std::optional<LocationSize> |