forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AArch64] Fix frame-pointer offset with hazard padding (llvm#118091)
The `-aarch64-stack-hazard-size=<val>` option disables register paring (as the hazard padding may mean the offset is too large for STP/LDP). This broke setting the frame-pointer offset, as the code to find the frame record looked for a (FP, LR) register pair. This patch resolves this by looking for FP, LR as two unpaired registers when hazard padding is enabled.
- Loading branch information
Showing
3 changed files
with
265 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 | ||
; RUN: llc < %s -mtriple=aarch64-windows-pc-msvc -aarch64-stack-hazard-size=0 | FileCheck %s --check-prefixes=CHECK0 | ||
; RUN: llc < %s -mtriple=aarch64-windows-pc-msvc -aarch64-stack-hazard-size=64 | FileCheck %s --check-prefixes=CHECK64 | ||
; RUN: llc < %s -mtriple=aarch64-windows-pc-msvc -aarch64-stack-hazard-size=1024 | FileCheck %s --check-prefixes=CHECK1024 | ||
|
||
define i32 @fpr_csr_stackobj(double %x) "aarch64_pstate_sm_compatible" "frame-pointer"="all" { | ||
; CHECK0-LABEL: fpr_csr_stackobj: | ||
; CHECK0: .seh_proc fpr_csr_stackobj | ||
; CHECK0-NEXT: // %bb.0: // %entry | ||
; CHECK0-NEXT: str x23, [sp, #-48]! // 8-byte Folded Spill | ||
; CHECK0-NEXT: .seh_save_reg_x x23, 48 | ||
; CHECK0-NEXT: stp x29, x30, [sp, #8] // 16-byte Folded Spill | ||
; CHECK0-NEXT: .seh_save_fplr 8 | ||
; CHECK0-NEXT: stp d9, d10, [sp, #24] // 16-byte Folded Spill | ||
; CHECK0-NEXT: .seh_save_fregp d9, 24 | ||
; CHECK0-NEXT: add x29, sp, #8 | ||
; CHECK0-NEXT: .seh_add_fp 8 | ||
; CHECK0-NEXT: .seh_endprologue | ||
; CHECK0-NEXT: mov w0, wzr | ||
; CHECK0-NEXT: //APP | ||
; CHECK0-NEXT: //NO_APP | ||
; CHECK0-NEXT: str d0, [x29, #32] | ||
; CHECK0-NEXT: .seh_startepilogue | ||
; CHECK0-NEXT: ldp d9, d10, [sp, #24] // 16-byte Folded Reload | ||
; CHECK0-NEXT: .seh_save_fregp d9, 24 | ||
; CHECK0-NEXT: ldp x29, x30, [sp, #8] // 16-byte Folded Reload | ||
; CHECK0-NEXT: .seh_save_fplr 8 | ||
; CHECK0-NEXT: ldr x23, [sp], #48 // 8-byte Folded Reload | ||
; CHECK0-NEXT: .seh_save_reg_x x23, 48 | ||
; CHECK0-NEXT: .seh_endepilogue | ||
; CHECK0-NEXT: ret | ||
; CHECK0-NEXT: .seh_endfunclet | ||
; CHECK0-NEXT: .seh_endproc | ||
; | ||
; CHECK64-LABEL: fpr_csr_stackobj: | ||
; CHECK64: .seh_proc fpr_csr_stackobj | ||
; CHECK64-NEXT: // %bb.0: // %entry | ||
; CHECK64-NEXT: sub sp, sp, #192 | ||
; CHECK64-NEXT: .seh_stackalloc 192 | ||
; CHECK64-NEXT: str x23, [sp, #80] // 8-byte Folded Spill | ||
; CHECK64-NEXT: .seh_save_reg x23, 80 | ||
; CHECK64-NEXT: str x29, [sp, #88] // 8-byte Folded Spill | ||
; CHECK64-NEXT: .seh_save_reg x29, 88 | ||
; CHECK64-NEXT: str x30, [sp, #96] // 8-byte Folded Spill | ||
; CHECK64-NEXT: .seh_save_reg x30, 96 | ||
; CHECK64-NEXT: str d9, [sp, #168] // 8-byte Folded Spill | ||
; CHECK64-NEXT: .seh_save_freg d9, 168 | ||
; CHECK64-NEXT: str d10, [sp, #176] // 8-byte Folded Spill | ||
; CHECK64-NEXT: .seh_save_freg d10, 176 | ||
; CHECK64-NEXT: add x29, sp, #88 | ||
; CHECK64-NEXT: .seh_add_fp 88 | ||
; CHECK64-NEXT: .seh_endprologue | ||
; CHECK64-NEXT: mov w0, wzr | ||
; CHECK64-NEXT: //APP | ||
; CHECK64-NEXT: //NO_APP | ||
; CHECK64-NEXT: stur d0, [x29, #-16] | ||
; CHECK64-NEXT: .seh_startepilogue | ||
; CHECK64-NEXT: ldr d10, [sp, #176] // 8-byte Folded Reload | ||
; CHECK64-NEXT: .seh_save_freg d10, 176 | ||
; CHECK64-NEXT: ldr d9, [sp, #168] // 8-byte Folded Reload | ||
; CHECK64-NEXT: .seh_save_freg d9, 168 | ||
; CHECK64-NEXT: ldr x30, [sp, #96] // 8-byte Folded Reload | ||
; CHECK64-NEXT: .seh_save_reg x30, 96 | ||
; CHECK64-NEXT: ldr x29, [sp, #88] // 8-byte Folded Reload | ||
; CHECK64-NEXT: .seh_save_reg x29, 88 | ||
; CHECK64-NEXT: ldr x23, [sp, #80] // 8-byte Folded Reload | ||
; CHECK64-NEXT: .seh_save_reg x23, 80 | ||
; CHECK64-NEXT: add sp, sp, #192 | ||
; CHECK64-NEXT: .seh_stackalloc 192 | ||
; CHECK64-NEXT: .seh_endepilogue | ||
; CHECK64-NEXT: ret | ||
; CHECK64-NEXT: .seh_endfunclet | ||
; CHECK64-NEXT: .seh_endproc | ||
; | ||
; CHECK1024-LABEL: fpr_csr_stackobj: | ||
; CHECK1024: .seh_proc fpr_csr_stackobj | ||
; CHECK1024-NEXT: // %bb.0: // %entry | ||
; CHECK1024-NEXT: sub sp, sp, #1072 | ||
; CHECK1024-NEXT: str x23, [sp] // 8-byte Folded Spill | ||
; CHECK1024-NEXT: str x29, [sp, #8] // 8-byte Folded Spill | ||
; CHECK1024-NEXT: .seh_save_reg x29, 8 | ||
; CHECK1024-NEXT: str x30, [sp, #16] // 8-byte Folded Spill | ||
; CHECK1024-NEXT: .seh_save_reg x30, 16 | ||
; CHECK1024-NEXT: str d9, [sp, #1048] // 8-byte Folded Spill | ||
; CHECK1024-NEXT: .seh_save_freg d9, 1048 | ||
; CHECK1024-NEXT: str d10, [sp, #1056] // 8-byte Folded Spill | ||
; CHECK1024-NEXT: .seh_save_freg d10, 1056 | ||
; CHECK1024-NEXT: add x29, sp, #8 | ||
; CHECK1024-NEXT: .seh_add_fp 8 | ||
; CHECK1024-NEXT: .seh_endprologue | ||
; CHECK1024-NEXT: sub sp, sp, #1040 | ||
; CHECK1024-NEXT: mov w0, wzr | ||
; CHECK1024-NEXT: //APP | ||
; CHECK1024-NEXT: //NO_APP | ||
; CHECK1024-NEXT: stur d0, [x29, #-16] | ||
; CHECK1024-NEXT: .seh_startepilogue | ||
; CHECK1024-NEXT: add sp, sp, #1040 | ||
; CHECK1024-NEXT: .seh_stackalloc 1040 | ||
; CHECK1024-NEXT: ldr d10, [sp, #1056] // 8-byte Folded Reload | ||
; CHECK1024-NEXT: .seh_save_freg d10, 1056 | ||
; CHECK1024-NEXT: ldr d9, [sp, #1048] // 8-byte Folded Reload | ||
; CHECK1024-NEXT: .seh_save_freg d9, 1048 | ||
; CHECK1024-NEXT: ldr x30, [sp, #16] // 8-byte Folded Reload | ||
; CHECK1024-NEXT: .seh_save_reg x30, 16 | ||
; CHECK1024-NEXT: ldr x29, [sp, #8] // 8-byte Folded Reload | ||
; CHECK1024-NEXT: .seh_save_reg x29, 8 | ||
; CHECK1024-NEXT: ldr x23, [sp] // 8-byte Folded Reload | ||
; CHECK1024-NEXT: add sp, sp, #1072 | ||
; CHECK1024-NEXT: .seh_endepilogue | ||
; CHECK1024-NEXT: ret | ||
; CHECK1024-NEXT: .seh_endfunclet | ||
; CHECK1024-NEXT: .seh_endproc | ||
entry: | ||
%a = alloca double | ||
tail call void asm sideeffect "", "~{x23},~{d9},~{d10}"() | ||
store double %x, ptr %a | ||
ret i32 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters