1 ; RUN: opt < %s -S -simplifycfg | FileCheck %s
3 ; In 'simplifycfg', during the flattening of a 'br', the instructions for the
4 ; 'true' and 'false' parts, are moved out from their respective basic blocks.
5 ; Their original debug locations (DILocations) and debug intrinsic instructions
6 ; (dbg.values) are removed.
7 ; As those basic blocks are now empty, their associated labels are removed.
9 ; For the given test case, the labels 'W' and 'cleanup4' are removed.
10 ; We're expecting the dbg.label associated with 'W' to disappear, because
11 ; the 'W' label was removed.
13 ; CHECK-LABEL: _Z7test_itv()
15 ; CHECK-NEXT: %retval.0 = select i1 undef, i16 1, i16 0
16 ; CHECK-NEXT: ret i16 0
18 define i16 @_Z7test_itv() {
22 sw.bb: ; preds = %entry
23 br i1 undef, label %W, label %cleanup4
26 call void @llvm.dbg.label(metadata !1), !dbg !8
29 cleanup4: ; preds = %W, %sw.bb
30 %retval.0 = phi i16 [ 1, %W ], [ 0, %sw.bb ]
34 ; Function Attrs: nounwind readnone speculatable
35 declare void @llvm.dbg.label(metadata) #0
37 attributes #0 = { nounwind readnone speculatable }
40 !llvm.module.flags = !{!0}
42 !0 = !{i32 2, !"Debug Info Version", i32 3}
43 !1 = !DILabel(scope: !2, name: "W", file: !3, line: 47)
44 !2 = distinct !DILexicalBlock(scope: !4, file: !3, line: 40, column: 3)
45 !3 = !DIFile(filename: "foo.c", directory: "./")
46 !4 = distinct !DISubprogram(name: "test_it", scope: !3, file: !3, line: 35, type: !5, scopeLine: 36, unit: !7)
47 !5 = !DISubroutineType(types: !6)
49 !7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
50 !8 = !DILocation(line: 47, column: 2, scope: !2)