1; RUN: opt -mtriple=x86_64-- -S --dse %s  -o - | FileCheck %s
2; Ensure that we can mark a value as undefined when performing dead
3; store elimination.
4; Bugzilla #45080
5
6@b = common dso_local local_unnamed_addr global i32 0, align 1
7
8define dso_local i32 @main() local_unnamed_addr !dbg !7 {
9  %1 = alloca i32, align 4
10  %2 = load i32, i32* @b, align 1, !dbg !13
11  ; CHECK: call void @llvm.dbg.value(metadata i32 undef
12  call void @llvm.dbg.value(metadata i32 %2, metadata !12, metadata !DIExpression()), !dbg !13
13  store i32 %2, i32* %1, align 4, !dbg !13
14  ret i32 0, !dbg !13
15}
16
17declare void @llvm.dbg.value(metadata, metadata, metadata)
18
19!llvm.dbg.cu = !{!0}
20!llvm.module.flags = !{!3, !4}
21!llvm.ident = !{!6}
22
23!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !2, nameTableKind: None)
24!1 = !DIFile(filename: "dead-store-elimination-marks-undef.ll", directory: "/temp/bz45080")
25!2 = !{}
26!3 = !{i32 2, !"Dwarf Version", i32 4}
27!4 = !{i32 2, !"Debug Info Version", i32 3}
28!6 = !{!"clang version 10.0.0"}
29!7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
30!8 = !DISubroutineType(types: !9)
31!9 = !{!10}
32!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
33!11 = !{!12}
34!12 = !DILocalVariable(name: "l_2864", scope: !7, file: !1, line: 4, type: !10)
35!13 = !DILocation(line: 5, column: 12, scope: !7)
36
37