From 0e73b1821cacb453c307cc1b9f35e989321b8e42 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 02:30:19 +0800 Subject: [CodeGen] Preserve variable-sized stack object offsets --- backend/lib/CodeGen/MachineFrameInfo.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'backend/lib/CodeGen/MachineFrameInfo.cpp') diff --git a/backend/lib/CodeGen/MachineFrameInfo.cpp b/backend/lib/CodeGen/MachineFrameInfo.cpp index 8c3e6e5..80e1ee0 100644 --- a/backend/lib/CodeGen/MachineFrameInfo.cpp +++ b/backend/lib/CodeGen/MachineFrameInfo.cpp @@ -114,9 +114,9 @@ Expected MachineFrameInfo::verifyDescription(const StackObjectDesc &Descri const bool IsVariable = Description.Kind == StackObjectKind::VariableSized || Description.Kind == StackObjectKind::DynamicAlloca; if (IsVariable) { - if (Description.Size || Description.Offset) { + if (Description.Size) { return makeUnexpected(ErrorCode::InvalidArgument, - "variable-sized stack objects cannot have a fixed size or offset"); + "variable-sized stack objects cannot have a fixed size"); } } else if (!Description.Size) { return makeUnexpected(ErrorCode::InvalidArgument, @@ -254,10 +254,6 @@ Expected MachineFrameInfo::setObjectOffset(FrameIndex Index, std::int64_t "live stack object unexpectedly lacks a description"); } StackObjectDesc Description = *CurrentDescription; - if ((*Object)->isVariableSized()) { - return makeUnexpected(ErrorCode::InvalidArgument, - "variable-sized stack object cannot have a fixed offset"); - } Description.Offset = Offset; (*Object)->Description.emplace(std::move(Description)); return {}; -- cgit v1.2.3