aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp11
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>