1 ; RUN: llc -O3 -stop-after virtregrewriter %s -o - | FileCheck %s
3 target datalayout = "E-m:e-i64:64-n32:64"
4 target triple = "ppc64"
6 ; Verify that live-debug-variables includes the stack slot offset
7 ; for the sub-register in the debug expression for `spilled'.
9 ; This reproducer was generated from the following C file:
11 ; extern int foo(void);
12 ; extern void bar(int);
15 ; int spilled = foo();
17 ; // Clobber all GPRs.
18 ; __asm volatile ("" : : : "0", "1", "2", "3", "4", "5", "6", "7",
19 ; "8", "9", "10", "11", "12", "13", "14", "15",
20 ; "16", "17", "18", "19", "20", "21", "22", "23",
21 ; "24", "25", "26", "27", "28", "29", "30", "31");
31 ; clang --target=ppc64 -O3 -g -S -emit-llvm
33 ; CHECK: ![[VAR:.*]] = !DILocalVariable(name: "spilled"
35 ; CHECK: STD $x3, 0, %stack.0
36 ; CHECK-NEXT: DBG_VALUE %stack.0, 0, ![[VAR]], !DIExpression(DW_OP_plus_uconst, 4)
38 ; Function Attrs: noreturn nounwind
39 define signext i32 @main() local_unnamed_addr #0 !dbg !8 {
41 %call = tail call signext i32 @foo() #2, !dbg !14
42 call void @llvm.dbg.value(metadata i32 %call, metadata !13, metadata !DIExpression()), !dbg !14
43 tail call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3},~{r4},~{r5},~{r6},~{r7},~{r8},~{r9},~{r10},~{r11},~{r12},~{r13},~{r14},~{r15},~{r16},~{r17},~{r18},~{r19},~{r20},~{r21},~{r22},~{r23},~{r24},~{r25},~{r26},~{r27},~{r28},~{r29},~{r30},~{r31}"() #2, !dbg !14, !srcloc !15
44 br label %for.cond, !dbg !14
46 for.cond: ; preds = %for.cond, %entry
47 tail call void @bar(i32 signext %call) #2, !dbg !14
48 br label %for.cond, !dbg !14
51 declare signext i32 @foo() local_unnamed_addr
53 declare void @bar(i32 signext) local_unnamed_addr
55 ; Function Attrs: nounwind readnone speculatable
56 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
58 attributes #0 = { noreturn nounwind }
59 attributes #1 = { nounwind readnone speculatable }
60 attributes #2 = { nounwind }
63 !llvm.module.flags = !{!3, !4, !5, !6}
66 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 8.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
67 !1 = !DIFile(filename: "live-debug-vars-subreg-offset.c", directory: "/")
69 !3 = !{i32 2, !"Dwarf Version", i32 4}
70 !4 = !{i32 2, !"Debug Info Version", i32 3}
71 !5 = !{i32 1, !"wchar_size", i32 4}
72 !6 = !{i32 7, !"PIC Level", i32 2}
73 !7 = !{!"clang version 8.0.0"}
74 !8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 4, type: !9, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !12)
75 !9 = !DISubroutineType(types: !10)
77 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
79 !13 = !DILocalVariable(name: "spilled", scope: !8, file: !1, line: 5, type: !11)
80 !14 = !DILocation(line: 5, column: 17, scope: !8)