• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -deadargelim %s | FileCheck %s
2
3; Don't eliminate dead arugments from naked functions.
4; CHECK: define internal i32 @naked(i32 %x)
5
6define internal i32 @naked(i32 %x) #0 {
7  tail call void asm sideeffect inteldialect "mov eax, [esp + $$4]\0A\09ret", "~{eax},~{dirflag},~{fpsr},~{flags}"()
8  unreachable
9}
10
11
12; Don't eliminate dead varargs from naked functions.
13; CHECK: define internal i32 @naked_va(i32 %x, ...)
14
15define internal i32 @naked_va(i32 %x, ...) #0 {
16  tail call void asm sideeffect inteldialect "mov eax, [esp + $$8]\0A\09ret", "~{eax},~{dirflag},~{fpsr},~{flags}"()
17  unreachable
18}
19
20define i32 @f(i32 %x, i32 %y) {
21  %r = call i32 @naked(i32 %x)
22  %s = call i32 (i32, ...) @naked_va(i32 %x, i32 %r)
23
24; Make sure the arguments are still there: not removed or replaced with undef.
25; CHECK: %r = call i32 @naked(i32 %x)
26; CHECK: %s = call i32 (i32, ...) @naked_va(i32 %x, i32 %r)
27
28  ret i32 %s
29}
30
31attributes #0 = { naked }
32