[llvm] [llvm] Consistently respect `naked` fn attribute in `TargetFrameLowering::hasFP()` (PR #106014)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 13:23:54 PDT 2024


================
@@ -0,0 +1,13 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc < %s -mtriple amdgcn | FileCheck %s -check-prefixes=NAKED
+
+define dso_local void @_start() naked "frame-pointer"="all" {
+; NAKED-LABEL: _start:
+; NAKED:       _start$local:
+; NAKED-NEXT:    .type _start$local, at function
+; NAKED-NEXT:  ; %bb.0:
+; NAKED-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; NAKED-NEXT:    s_swappc_b64 s[30:31], 42
+  call void inttoptr (i32 42 to ptr)()
----------------
arichardson wrote:

```suggestion
declare dso_local void @main()

define dso_local void @_start() naked "frame-pointer"="all" {
; NAKED-LABEL: _start:
; NAKED:       _start$local:
; NAKED-NEXT:    .type _start$local, at function
; NAKED-NEXT:  ; %bb.0:
; NAKED-NEXT:    s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
; NAKED-NEXT:    s_swappc_b64 s[30:31], 42
  call void @main()
```

I'd prefer to avoid not strictly necessary inttoptr calls in tests. How about this since @llvm.trap() does not work everywhere?

https://github.com/llvm/llvm-project/pull/106014


More information about the llvm-commits mailing list