1; RUN: opt < %s -instcombine -S | FileCheck %s
2
3; When removing the llvm.dbg.value intrinsic in the unreachable block
4; InstCombine would incorrectly return a false Modified status.
5
6; CHECK: cond.true:
7; CHECK-NEXT: br label %cond.end
8
9define i32 @foo() !dbg !7 {
10entry:
11  br i1 false, label %cond.true, label %cond.end
12
13cond.true:
14  call void @llvm.dbg.value(metadata i32 undef, metadata !12, metadata !DIExpression()), !dbg !13
15  br label %cond.end
16
17cond.end:
18  ret i32 undef
19}
20
21declare void @llvm.dbg.value(metadata, metadata, metadata) #0
22
23attributes #0 = { nounwind readnone speculatable willreturn }
24
25!llvm.dbg.cu = !{!0}
26!llvm.module.flags = !{!3, !4}
27!llvm.ident = !{!6}
28
29!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
30!1 = !DIFile(filename: "foo.c", directory: "/")
31!2 = !{}
32!3 = !{i32 7, !"Dwarf Version", i32 4}
33!4 = !{i32 2, !"Debug Info Version", i32 3}
34!6 = !{!"clang version 12.0.0"}
35!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
36!8 = !DISubroutineType(types: !9)
37!9 = !{!10}
38!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
39!11 = !{!12, !12}
40!12 = !DILocalVariable(name: "bar", scope: !7, file: !1, line: 1, type: !10)
41!13 = !DILocation(line: 0, scope: !7)
42