Rebase of #84114. I've only included the core changes to frame layout calculation & CFI generation which sidesteps the regressions found after merging #84114. Since these changes are a necessary precursor to the overall fix and are themselves slightly beneficial as CFI is now generated correctly, I think it is reasonable to merge this first step. --- For very large stack frames, the offset from the stack pointer to a local can be more than 2^31 which overflows various `int` offsets in the frame lowering code. This patch updates the frame lowering code to calculate the offsets as 64-bit values and fixes CFI to use the corrected sizes. After this patch, additional work is needed to fix offset truncations in each target's codegen.
25 lines
956 B
LLVM
25 lines
956 B
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --no_x86_scrub_sp --version 4
|
|
; RUN: llc -O0 -mtriple=x86_64 -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK
|
|
%large = type [4294967295 x i8]
|
|
|
|
define void @foo() unnamed_addr #0 {
|
|
; CHECK-LABEL: foo:
|
|
; CHECK: # %bb.0:
|
|
; CHECK-NEXT: movabsq $8589934462, %rax # imm = 0x1FFFFFF7E
|
|
; CHECK-NEXT: subq %rax, %rsp
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 8589934470
|
|
; CHECK-NEXT: movb $42, -129(%rsp)
|
|
; CHECK-NEXT: movb $43, -128(%rsp)
|
|
; CHECK-NEXT: movabsq $8589934462, %rax # imm = 0x1FFFFFF7E
|
|
; CHECK-NEXT: addq %rax, %rsp
|
|
; CHECK-NEXT: .cfi_def_cfa_offset 8
|
|
; CHECK-NEXT: retq
|
|
%1 = alloca %large, align 1
|
|
%2 = alloca %large, align 1
|
|
%3 = getelementptr inbounds %large, ptr %1, i64 0, i64 0
|
|
store i8 42, ptr %3, align 1
|
|
%4 = getelementptr inbounds %large, ptr %2, i64 0, i64 0
|
|
store i8 43, ptr %4, align 1
|
|
ret void
|
|
}
|