1; RUN: llc -mtriple=armv4t-unknown-unknown -start-after=codegenprepare -stop-before=finalize-isel -o - %s | FileCheck %s
2
3; Verify that a stack-referencing DBG_VALUE is emitted for p5 at the start of
4; the function.
5;
6; Reproducer for PR40777.
7;
8; Based on the following C reproducer:
9;
10;   float fn1(int p1, int p2, int p3, int p4, float p5) {
11;    return p5;
12;   }
13;
14; that was compiled using -O1 -g -S -emit-llvm.
15;
16; Irrelevant metadata, e.g. information about %p[1-4], has been stripped.
17
18; CHECK: ![[P5:[0-9]*]] = !DILocalVariable(name: "p5"
19
20define arm_aapcscc float @fn1(i32 %p1, i32 %p2, i32 %p3, i32 %p4, float returned %p5) #0 !dbg !7 {
21; CHECK-LABEL: bb.0.entry:
22; CHECK-NEXT: DBG_VALUE %fixed-stack.0, 0, ![[P5]]
23entry:
24  call void @llvm.dbg.value(metadata float %p5, metadata !17, metadata !DIExpression()), !dbg !18
25  ret float %p5, !dbg !19
26}
27
28; Function Attrs: nounwind readnone speculatable
29declare void @llvm.dbg.value(metadata, metadata, metadata) #1
30
31attributes #0 = { norecurse nounwind readnone }
32attributes #1 = { nounwind readnone speculatable }
33
34!llvm.dbg.cu = !{!0}
35!llvm.module.flags = !{!3, !4, !5}
36!llvm.ident = !{!6}
37
38!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
39!1 = !DIFile(filename: "float.c", directory: "/")
40!2 = !{}
41!3 = !{i32 2, !"Dwarf Version", i32 4}
42!4 = !{i32 2, !"Debug Info Version", i32 3}
43!5 = !{i32 1, !"min_enum_size", i32 4}
44!6 = !{!"clang version 9.0.0"}
45!7 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
46!8 = !DISubroutineType(types: !9)
47!9 = !{!10, !11, !11, !11, !11, !10}
48!10 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)
49!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
50!12 = !{!17}
51!17 = !DILocalVariable(name: "p5", arg: 5, scope: !7, file: !1, line: 1, type: !10)
52!18 = !DILocation(line: 1, scope: !7)
53!19 = !DILocation(line: 2, scope: !7)
54