1 ; RUN: llc %s -start-after=codegenprepare -stop-before=finalize-isel -experimental-debug-variable-locations=false -o - | FileCheck %s
\r
3 ;; Generated from clang -O2 -emit-llvm -S -g reduce.c -o -
\r
10 ;; int *e = &b->a - 1; // XXX
\r
14 ;; The line marked XXX becomes a load and gep in IR. We have a variadic
\r
15 ;; dbg.value using the gep, but we lose that gep in SelectionDAG. Ensure that
\r
16 ;; we salvage the value.
\r
18 ; CHECK: [[E_REG:%[0-9]+]]{{.+}} = MOV{{.+}} @b
\r
19 ; CHECK: DBG_VALUE_LIST {{.*}}, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_constu, 4, DW_OP_minus, DW_OP_stack_value), [[E_REG]], debug-location
\r
21 target triple = "x86_64-unknown-linux-gnu"
\r
23 %struct.anon = type { i32 }
\r
25 @b = dso_local local_unnamed_addr global %struct.anon* null, align 8, !dbg !0
\r
26 @c = dso_local local_unnamed_addr global i32 0, align 4, !dbg !6
\r
28 define dso_local void @d() local_unnamed_addr !dbg !17 {
\r
30 %0 = load %struct.anon*, %struct.anon** @b, align 8, !dbg !23
\r
31 %add.ptr = getelementptr inbounds %struct.anon, %struct.anon* %0, i64 -1, i32 0, !dbg !28
\r
32 call void @llvm.dbg.value(metadata !DIArgList(i32* %add.ptr), metadata !21, metadata !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value)), !dbg !29
\r
33 %1 = load i32, i32* %add.ptr, align 4, !dbg !30
\r
34 store i32 %1, i32* @c, align 4, !dbg !33
\r
38 declare void @llvm.dbg.value(metadata, metadata, metadata)
\r
40 !llvm.dbg.cu = !{!2}
\r
41 !llvm.module.flags = !{!13, !14, !15}
\r
42 !llvm.ident = !{!16}
\r
44 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
\r
45 !1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 3, type: !9, isLocal: false, isDefinition: true)
\r
46 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)
\r
47 !3 = !DIFile(filename: "reduce.c", directory: "/")
\r
50 !6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())
\r
51 !7 = distinct !DIGlobalVariable(name: "c", scope: !2, file: !3, line: 4, type: !8, isLocal: false, isDefinition: true)
\r
52 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
\r
53 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64)
\r
54 !10 = distinct !DICompositeType(tag: DW_TAG_structure_type, file: !3, line: 1, size: 32, elements: !11)
\r
56 !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !10, file: !3, line: 2, baseType: !8, size: 32)
\r
57 !13 = !{i32 7, !"Dwarf Version", i32 4}
\r
58 !14 = !{i32 2, !"Debug Info Version", i32 3}
\r
59 !15 = !{i32 1, !"wchar_size", i32 4}
\r
60 !16 = !{!"clang version 11.0.0"}
\r
61 !17 = distinct !DISubprogram(name: "d", scope: !3, file: !3, line: 5, type: !18, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !20)
\r
62 !18 = !DISubroutineType(types: !19)
\r
65 !21 = !DILocalVariable(name: "e", scope: !17, file: !3, line: 6, type: !22)
\r
66 !22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
\r
67 !23 = !DILocation(line: 6, column: 13, scope: !17)
\r
68 !28 = !DILocation(line: 6, column: 18, scope: !17)
\r
69 !29 = !DILocation(line: 0, scope: !17)
\r
70 !30 = !DILocation(line: 7, column: 7, scope: !17)
\r
71 !33 = !DILocation(line: 7, column: 5, scope: !17)
\r
72 !34 = !DILocation(line: 8, column: 1, scope: !17)
\r