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