llvm-project/llvm/test/CodeGen/ARM/naked-fn-with-frame-pointer.ll
Alex Rønne Petersen ad4a582fd9
[llvm] Consistently respect naked fn attribute in TargetFrameLowering::hasFP() (#106014)
Some targets (e.g. PPC and Hexagon) already did this. I think it's best
to do this consistently so that frontend authors don't run into
inconsistent results when they emit `naked` functions. For example, in
Zig, we had to change our emit code to also set `frame-pointer=none` to
get reliable results across targets.

Note: I don't have commit access.
2024-10-18 09:35:42 +04:00

56 lines
1.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple arm | FileCheck %s -check-prefixes=CHECK-ALE
; RUN: llc < %s -mtriple armeb | FileCheck %s -check-prefixes=CHECK-ABE
; RUN: llc < %s -mtriple thumb | FileCheck %s -check-prefixes=CHECK-TLE
; RUN: llc < %s -mtriple thumbeb | FileCheck %s -check-prefixes=CHECK-TBE
declare dso_local void @main()
define dso_local void @naked() naked "frame-pointer"="all" {
; CHECK-ALE-LABEL: naked:
; CHECK-ALE: @ %bb.0:
; CHECK-ALE-NEXT: bl main
;
; CHECK-ABE-LABEL: naked:
; CHECK-ABE: @ %bb.0:
; CHECK-ABE-NEXT: bl main
;
; CHECK-TLE-LABEL: naked:
; CHECK-TLE: @ %bb.0:
; CHECK-TLE-NEXT: bl main
;
; CHECK-TBE-LABEL: naked:
; CHECK-TBE: @ %bb.0:
; CHECK-TBE-NEXT: bl main
call void @main()
unreachable
}
define dso_local void @normal() "frame-pointer"="all" {
; CHECK-ALE-LABEL: normal:
; CHECK-ALE: @ %bb.0:
; CHECK-ALE-NEXT: push {r11, lr}
; CHECK-ALE-NEXT: mov r11, sp
; CHECK-ALE-NEXT: bl main
;
; CHECK-ABE-LABEL: normal:
; CHECK-ABE: @ %bb.0:
; CHECK-ABE-NEXT: push {r11, lr}
; CHECK-ABE-NEXT: mov r11, sp
; CHECK-ABE-NEXT: bl main
;
; CHECK-TLE-LABEL: normal:
; CHECK-TLE: @ %bb.0:
; CHECK-TLE-NEXT: push {r7, lr}
; CHECK-TLE-NEXT: add r7, sp, #0
; CHECK-TLE-NEXT: bl main
;
; CHECK-TBE-LABEL: normal:
; CHECK-TBE: @ %bb.0:
; CHECK-TBE-NEXT: push {r7, lr}
; CHECK-TBE-NEXT: add r7, sp, #0
; CHECK-TBE-NEXT: bl main
call void @main()
unreachable
}