[VPlan] Add incoming values for all predecessor to ResumePHI (NFCI).
[llvm-project.git] / llvm / test / DebugInfo / assignment-tracking / X86 / assignment-tracking-not-enabled.ll
blob2f0b4fd284b9a44d671c455b598f397ee998314d
1 ; RUN: llc %s -stop-after=finalize-isel -o - \
2 ; RUN: | FileCheck %s --implicit-check-not=DBG_
5 ; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \
6 ; RUN: | FileCheck %s --implicit-check-not=DBG_
8 ;; Check that SelectionDAG downgrades dbg.assigns to dbg.values if assignment
9 ;; tracking isn't enabled (e.g. if the module flag
10 ;; "debug-info-assignment-tracking" is missing / false).
12 ;; With assignment tracking enabled we'd see the variable put into the stack
13 ;; slot side table because the variable is always located in its stack
14 ;; slot. Check there's no debug-info saved there:
15 ;; CHECK: stack:
16 ;; CHECK-NEXT: - { id: 0, name: x, type: default, offset: 0, size: 4, alignment: 4,
17 ;; CHECK-NEXT:     stack-id: default, callee-saved-register: '', callee-saved-restored: true,
18 ;; CHECK-NEXT:     debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
20 ;; With assignment tracking disabled we should see the dbg.assigns downgraded
21 ;; to dbg.values, which become DBG _VALUEs/_INSTR_REFs.
22 ; CHECK: bb.0.entry:
23 ; CHECK: DBG_VALUE $noreg
25 ; CHECK: bb.1.if.then:
26 ; CHECK: DBG_INSTR_REF
28 ; CHECK: bb.2.if.else:
29 ; CHECK: DBG_VALUE 2
31 target triple = "x86_64-unknown-unknown"
33 @g = dso_local global i32 0, align 4, !dbg !0
35 define dso_local noundef i32 @_Z3funv() #0 !dbg !15 {
36 entry:
37   %x = alloca i32, align 4, !DIAssignID !19
38   call void @llvm.dbg.assign(metadata i1 undef, metadata !20, metadata !DIExpression(), metadata !19, metadata ptr %x, metadata !DIExpression()), !dbg !21
39   %0 = load i32, ptr @g, align 4
40   %tobool = icmp ne i32 %0, 0
41   br i1 %tobool, label %if.then, label %if.else
43 if.then:                                          ; preds = %entry
44   %call = call noundef i32 @_Z3getv()
45   store i32 %call, ptr %x, align 4, !DIAssignID !27
46   call void @llvm.dbg.assign(metadata i32 %call, metadata !20, metadata !DIExpression(), metadata !27, metadata ptr %x, metadata !DIExpression()), !dbg !21
47   br label %if.end
49 if.else:                                          ; preds = %entry
50   store i32 2, ptr %x, align 4, !DIAssignID !30
51   call void @llvm.dbg.assign(metadata i32 2, metadata !20, metadata !DIExpression(), metadata !30, metadata ptr %x, metadata !DIExpression()), !dbg !21
52   br label %if.end
54 if.end:                                           ; preds = %if.else, %if.then
55   %1 = load i32, ptr %x, align 4
56   ret i32 %1
59 declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #1
60 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
61 declare noundef i32 @_Z3getv() #2
63 !llvm.dbg.cu = !{!2}
64 !llvm.module.flags = !{!6, !7}
65 !llvm.ident = !{!14}
67 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
68 !1 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !3, line: 1, type: !5, isLocal: false, isDefinition: true)
69 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 17.0.0)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
70 !3 = !DIFile(filename: "test.cpp", directory: "/")
71 !4 = !{!0}
72 !5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
73 !6 = !{i32 7, !"Dwarf Version", i32 5}
74 !7 = !{i32 2, !"Debug Info Version", i32 3}
75 !14 = !{!"clang version 17.0.0"}
76 !15 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 3, type: !16, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !18)
77 !16 = !DISubroutineType(types: !17)
78 !17 = !{!5}
79 !18 = !{}
80 !19 = distinct !DIAssignID()
81 !20 = !DILocalVariable(name: "x", scope: !15, file: !3, line: 4, type: !5)
82 !21 = !DILocation(line: 0, scope: !15)
83 !23 = distinct !DILexicalBlock(scope: !15, file: !3, line: 5, column: 7)
84 !27 = distinct !DIAssignID()
85 !30 = distinct !DIAssignID()