|
| 1 | +; Test that the debug information is propagated correctly to the new instructions |
| 2 | +; RUN: opt < %s -passes=ipsccp -S | FileCheck %s |
| 3 | + |
| 4 | +define double @sdiv_ashr_sitofp_dbg_pres(i7 %y) !dbg !5 { |
| 5 | +; CHECK-LABEL: define double @sdiv_ashr_sitofp_dbg_pres( |
| 6 | +; CHECK: [[SDIV:%.*]] = udiv i8 42, [[ZEXT1:%.*]], !dbg [[DBG9:![0-9]+]] |
| 7 | +; CHECK: [[ASHR:%.*]] = lshr i8 42, [[SDIV]], !dbg [[DBG10:![0-9]+]] |
| 8 | +; CHECK: [[SITOFP:%.*]] = uitofp nneg i16 [[ZEXT2:%.*]] to double, !dbg [[DBG12:![0-9]+]] |
| 9 | +; |
| 10 | + %zext1 = zext i7 %y to i8, !dbg !8 |
| 11 | + %sdiv = sdiv i8 42, %zext1, !dbg !9 |
| 12 | + %ashr = ashr i8 42, %sdiv, !dbg !10 |
| 13 | + %zext2 = zext i8 %ashr to i16, !dbg !11 |
| 14 | + %sitofp = sitofp i16 %zext2 to double, !dbg !12 |
| 15 | + ret double %sitofp, !dbg !13 |
| 16 | +} |
| 17 | + |
| 18 | +define i32 @test_duplicate_successors_phi(i1 %c, i32 %x) !dbg !14 { |
| 19 | +; CHECK-LABEL: define i32 @test_duplicate_successors_phi( |
| 20 | +; CHECK: switch: |
| 21 | +; CHECK-NEXT: br label %[[SWITCH_DEFAULT:.*]], !dbg [[DBG16:![0-9]+]] |
| 22 | +; |
| 23 | +entry: |
| 24 | + br i1 %c, label %switch, label %end, !dbg !15 |
| 25 | + |
| 26 | +switch: ; preds = %entry |
| 27 | + switch i32 -1, label %switch.default [ |
| 28 | + i32 0, label %end |
| 29 | + i32 1, label %end |
| 30 | + ], !dbg !16 |
| 31 | + |
| 32 | +switch.default: ; preds = %switch |
| 33 | + ret i32 -1, !dbg !17 |
| 34 | + |
| 35 | +end: ; preds = %switch, %switch, %entry |
| 36 | + %phi = phi i32 [ %x, %entry ], [ 1, %switch ], [ 1, %switch ], !dbg !18 |
| 37 | + ret i32 %phi, !dbg !19 |
| 38 | +} |
| 39 | + |
| 40 | +!llvm.dbg.cu = !{!0} |
| 41 | +!llvm.debugify = !{!2, !3} |
| 42 | +!llvm.module.flags = !{!4} |
| 43 | + |
| 44 | +;. |
| 45 | +; CHECK: [[DBG9]] = !DILocation(line: 2 |
| 46 | +; CHECK: [[DBG10]] = !DILocation(line: 3 |
| 47 | +; CHECK: [[DBG12]] = !DILocation(line: 5 |
| 48 | +; CHECK: [[DBG16]] = !DILocation(line: 8 |
| 49 | +;. |
| 50 | + |
| 51 | + |
| 52 | +!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) |
| 53 | +!1 = !DIFile(filename: "sccp.ll", directory: "/") |
| 54 | +!2 = !{i32 11} |
| 55 | +!3 = !{i32 0} |
| 56 | +!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 57 | +!5 = distinct !DISubprogram(name: "sdiv_ashr_sitofp_dbg_pres", linkageName: "sdiv_ashr_sitofp_dbg_pres", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) |
| 58 | +!6 = !DISubroutineType(types: !7) |
| 59 | +!7 = !{} |
| 60 | +!8 = !DILocation(line: 1, column: 1, scope: !5) |
| 61 | +!9 = !DILocation(line: 2, column: 1, scope: !5) |
| 62 | +!10 = !DILocation(line: 3, column: 1, scope: !5) |
| 63 | +!11 = !DILocation(line: 4, column: 1, scope: !5) |
| 64 | +!12 = !DILocation(line: 5, column: 1, scope: !5) |
| 65 | +!13 = !DILocation(line: 6, column: 1, scope: !5) |
| 66 | +!14 = distinct !DISubprogram(name: "test_duplicate_successors_phi", linkageName: "test_duplicate_successors_phi", scope: null, file: !1, line: 7, type: !6, scopeLine: 7, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) |
| 67 | +!15 = !DILocation(line: 7, column: 1, scope: !14) |
| 68 | +!16 = !DILocation(line: 8, column: 1, scope: !14) |
| 69 | +!17 = !DILocation(line: 9, column: 1, scope: !14) |
| 70 | +!18 = !DILocation(line: 10, column: 1, scope: !14) |
| 71 | +!19 = !DILocation(line: 11, column: 1, scope: !14) |
0 commit comments