114 lines · plain
1; RUN: opt -S -passes=jump-threading < %s | FileCheck %s2 3; @process_block_branch checks that JumpThreading's processBlock() propagates 4; the debug location to the new branch instruction.5 6; @process_threadable_edges_branch checks that JumpThreading's processThreadableEdges()7; propagates the debug location to the new branch instruction.8 9define i32 @process_block_branch(i32 %action) #0 !dbg !5 {10; CHECK-LABEL: define i32 @process_block_branch(11; CHECK: for.cond:12; CHECK-NEXT: br label %for.cond, !dbg [[DBG10:![0-9]+]]13;14entry:15 switch i32 %action, label %lor.rhs [16 i32 1, label %if.then17 i32 0, label %lor.end18 ], !dbg !819 20if.then: ; preds = %for.cond, %lor.end, %entry21 ret i32 undef, !dbg !922 23lor.rhs: ; preds = %entry24 br label %lor.end, !dbg !1025 26lor.end: ; preds = %lor.rhs, %entry27 br i1 false, label %for.cond, label %if.then, !dbg !1228 29for.cond: ; preds = %for.body, %lor.end30 br i1 false, label %if.then, label %for.body, !dbg !1331 32for.body: ; preds = %for.cond33 br label %for.cond, !dbg !1434}35 36define void @process_threadable_edges_branch(i32 %value) #0 !dbg !15 {37; CHECK-LABEL: define void @process_threadable_edges_branch(38; CHECK: L0:39; CHECK: br label %L2, !dbg [[DBG17:![0-9]+]]40;41entry:42 %cmp = icmp eq i32 %value, 32, !dbg !1643 %add = add i32 %value, 64, !dbg !1744 br i1 %cmp, label %L0, label %L2, !dbg !1845 46L0: ; preds = %entry47 %0 = call i32 @f2(), !dbg !1948 %1 = call i32 @f2(), !dbg !2049 switch i32 %add, label %L3 [50 i32 32, label %L151 i32 96, label %L252 ], !dbg !2153 54L1: ; preds = %L055 call void @f3(), !dbg !2256 ret void, !dbg !2357 58L2: ; preds = %L0, %entry59 call void @f4(i32 %add), !dbg !2460 ret void, !dbg !2561 62L3: ; preds = %L063 call void @f3(), !dbg !2664 ret void, !dbg !2765}66 67declare i32 @f1()68 69declare i32 @f2()70 71declare void @f3()72 73declare void @f4(i32)74 75attributes #0 = { nounwind }76 77!llvm.dbg.cu = !{!0}78!llvm.debugify = !{!2, !3}79!llvm.module.flags = !{!4}80 81;.82; CHECK: [[DBG10]] = !DILocation(line: 6,83; CHECK: [[DBG17]] = !DILocation(line: 13,84;.85 86!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)87!1 = !DIFile(filename: "temp.ll", directory: "/")88!2 = !{i32 30}89!3 = !{i32 0}90!4 = !{i32 2, !"Debug Info Version", i32 3}91!5 = distinct !DISubprogram(name: "process_block_branch", linkageName: "process_block_branch", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)92!6 = !DISubroutineType(types: !7)93!7 = !{}94!8 = !DILocation(line: 1, column: 1, scope: !5)95!9 = !DILocation(line: 2, column: 1, scope: !5)96!10 = !DILocation(line: 3, column: 1, scope: !5)97!11 = !DILocation(line: 4, column: 1, scope: !5)98!12 = !DILocation(line: 5, column: 1, scope: !5)99!13 = !DILocation(line: 6, column: 1, scope: !5)100!14 = !DILocation(line: 7, column: 1, scope: !5)101!15 = distinct !DISubprogram(name: "process_threadable_edges_branch", linkageName: "process_threadable_edges_branch", scope: null, file: !1, line: 8, type: !6, scopeLine: 8, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)102!16 = !DILocation(line: 8, column: 1, scope: !15)103!17 = !DILocation(line: 9, column: 1, scope: !15)104!18 = !DILocation(line: 10, column: 1, scope: !15)105!19 = !DILocation(line: 11, column: 1, scope: !15)106!20 = !DILocation(line: 12, column: 1, scope: !15)107!21 = !DILocation(line: 13, column: 1, scope: !15)108!22 = !DILocation(line: 14, column: 1, scope: !15)109!23 = !DILocation(line: 15, column: 1, scope: !15)110!24 = !DILocation(line: 16, column: 1, scope: !15)111!25 = !DILocation(line: 17, column: 1, scope: !15)112!26 = !DILocation(line: 18, column: 1, scope: !15)113!27 = !DILocation(line: 19, column: 1, scope: !15)114