113 lines · plain
1; RUN: opt < %s -passes=gvn-sink -S | FileCheck %s2 3; Test that GVNSink correctly merges the debug locations of sinked instruction4 5define zeroext i1 @test18(i32 %flag, i32 %blksA, i32 %blksB, i32 %nblks) !dbg !5 {6; CHECK: if.end:7; CHECK-NEXT: [[CMP2_SINK:%.*]] = phi i1 [ %cmp2, %if.then2 ], [ %cmp, %if.then ], [ %cmp3, %if.then3 ]8; CHECK-NEXT: [[FROMBOOL4:%.*]] = zext i1 [[CMP2_SINK]] to i8, !dbg [[DBG17:![0-9]+]]9;10entry:11 switch i32 %flag, label %if.then3 [12 i32 0, label %if.then13 i32 1, label %if.then214 ], !dbg !815 16if.then: ; preds = %entry17 %cmp = icmp uge i32 %blksA, %nblks, !dbg !918 %frombool1 = zext i1 %cmp to i8, !dbg !1019 br label %if.end, !dbg !1120 21if.then2: ; preds = %entry22 %add = add i32 %nblks, %blksB, !dbg !1223 %cmp2 = icmp ule i32 %add, %blksA, !dbg !1324 %frombool3 = zext i1 %cmp2 to i8, !dbg !1425 br label %if.end, !dbg !1526 27if.then3: ; preds = %entry28 %add2 = add i32 %nblks, %blksA, !dbg !1629 %cmp3 = icmp ule i32 %add2, %blksA, !dbg !1730 %frombool4 = zext i1 %cmp3 to i8, !dbg !1831 br label %if.end, !dbg !1932 33if.end: ; preds = %if.then3, %if.then2, %if.then34 %obeys.0 = phi i8 [ %frombool1, %if.then ], [ %frombool3, %if.then2 ], [ %frombool4, %if.then3 ], !dbg !2035 %tobool4 = icmp ne i8 %obeys.0, 0, !dbg !2136 ret i1 %tobool4, !dbg !2237}38 39define zeroext i1 @test_pr30244(i1 zeroext %flag, i1 zeroext %flag2, i32 %blksA, i32 %blksB, i32 %nblks) !dbg !23 {40; CHECK: if.end.gvnsink.split:41; CHECK-NEXT: [[CMP2_SINK:%.*]] = phi i1 [ %cmp2, %if.then2 ], [ %cmp, %if.then ]42; CHECK-NEXT: [[FROMBOOL1:%.*]] = zext i1 [[CMP2_SINK]] to i8, !dbg [[DBG29:![0-9]+]]43;44entry:45 %p = alloca i8, align 1, !dbg !2446 br i1 %flag, label %if.then, label %if.else, !dbg !2547 48if.then: ; preds = %entry49 %cmp = icmp uge i32 %blksA, %nblks, !dbg !2650 %frombool1 = zext i1 %cmp to i8, !dbg !2751 store i8 %frombool1, ptr %p, align 1, !dbg !2852 br label %if.end, !dbg !2953 54if.else: ; preds = %entry55 br i1 %flag2, label %if.then2, label %if.end, !dbg !3056 57if.then2: ; preds = %if.else58 %add = add i32 %nblks, %blksB, !dbg !3159 %cmp2 = icmp ule i32 %add, %blksA, !dbg !3260 %frombool3 = zext i1 %cmp2 to i8, !dbg !3361 store i8 %frombool3, ptr %p, align 1, !dbg !3462 br label %if.end, !dbg !3563 64if.end: ; preds = %if.then2, %if.else, %if.then65 ret i1 true, !dbg !3666}67 68!llvm.dbg.cu = !{!0}69!llvm.debugify = !{!2, !3}70!llvm.module.flags = !{!4}71 72!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)73!1 = !DIFile(filename: "sink-common-code.ll", directory: "/")74!2 = !{i32 28}75!3 = !{i32 0}76!4 = !{i32 2, !"Debug Info Version", i32 3}77!5 = distinct !DISubprogram(name: "test18", linkageName: "test18", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)78!6 = !DISubroutineType(types: !7)79!7 = !{}80!8 = !DILocation(line: 1, column: 1, scope: !5)81!9 = !DILocation(line: 2, column: 1, scope: !5)82!10 = !DILocation(line: 3, column: 1, scope: !5)83!11 = !DILocation(line: 4, column: 1, scope: !5)84!12 = !DILocation(line: 5, column: 1, scope: !5)85!13 = !DILocation(line: 6, column: 1, scope: !5)86!14 = !DILocation(line: 7, column: 1, scope: !5)87!15 = !DILocation(line: 8, column: 1, scope: !5)88!16 = !DILocation(line: 9, column: 1, scope: !5)89!17 = !DILocation(line: 10, column: 1, scope: !5)90!18 = !DILocation(line: 11, column: 1, scope: !5)91!19 = !DILocation(line: 12, column: 1, scope: !5)92!20 = !DILocation(line: 13, column: 1, scope: !5)93!21 = !DILocation(line: 14, column: 1, scope: !5)94!22 = !DILocation(line: 15, column: 1, scope: !5)95!23 = distinct !DISubprogram(name: "test_pr30244", linkageName: "test_pr30244", scope: null, file: !1, line: 16, type: !6, scopeLine: 16, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)96!24 = !DILocation(line: 16, column: 1, scope: !23)97!25 = !DILocation(line: 17, column: 1, scope: !23)98!26 = !DILocation(line: 18, column: 1, scope: !23)99!27 = !DILocation(line: 19, column: 1, scope: !23)100!28 = !DILocation(line: 20, column: 1, scope: !23)101!29 = !DILocation(line: 21, column: 1, scope: !23)102!30 = !DILocation(line: 22, column: 1, scope: !23)103!31 = !DILocation(line: 23, column: 1, scope: !23)104!32 = !DILocation(line: 24, column: 1, scope: !23)105!33 = !DILocation(line: 25, column: 1, scope: !23)106!34 = !DILocation(line: 26, column: 1, scope: !23)107!35 = !DILocation(line: 27, column: 1, scope: !23)108!36 = !DILocation(line: 28, column: 1, scope: !23)109;.110; CHECK: [[DBG17]] = !DILocation(line: 0111; CHECK: [[DBG29]] = !DILocation(line: 0112;.113