80 lines · plain
1; RUN: opt %s --passes=jump-threading -S -o - -S | FileCheck %s2 3;; +-> T1 -+4;; | v +-> T2.5;; Entry -+ Merge -+6;; | ^ +-> F2.7;; +-> F1 -+8;;9;; Thread T1 -> T2 and F1 -> F2 through Merge.10;;11;; +-> T1 (+ Merge + T2).12;; |13;; Entry -+14;; |15;; +-> F1 (+ Merge + F2).16;;17;; Check the duplicated instructions atoms are remapped.18 19; CHECK: T2:20; CHECK-NEXT: %v1 = call i32 @f1()21; CHECK-NEXT: %C3 = add i32 %v1, 1, !dbg [[G2R2:!.*]]22; CHECK-NEXT: store i32 %C3, ptr %p, align 4, !dbg [[G2R1:!.*]]23 24; CHECK: F2:25; CHECK-NEXT: %v2 = call i32 @f2()26; CHECK-NEXT: %C = add i32 %v2, 1, !dbg [[G1R2:!.*]]27; CHECK-NEXT: store i32 %C, ptr %p, align 4, !dbg [[G1R1:!.*]]28 29; CHECK: distinct !DISubprogram(name: "test1", {{.*}}keyInstructions: true)30; CHECK: [[G2R2]] = !DILocation(line: 8, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 2)31; CHECK: [[G2R1]] = !DILocation(line: 8, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 1)32; CHECK: [[G1R2]] = !DILocation(line: 8, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 2)33; CHECK: [[G1R1]] = !DILocation(line: 8, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 1)34 35define i32 @test1(i1 %cond, ptr %p) !dbg !5 {36 br i1 %cond, label %T1, label %F137 38T1: ; preds = %039 %v1 = call i32 @f1()40 br label %Merge41 42F1: ; preds = %043 %v2 = call i32 @f2()44 br label %Merge45 46Merge: ; preds = %F1, %T147 %A = phi i1 [ true, %T1 ], [ false, %F1 ]48 %B = phi i32 [ %v1, %T1 ], [ %v2, %F1 ]49 %C = add i32 %B, 1, !dbg !850 store i32 %C, ptr %p, align 4, !dbg !951 br i1 %A, label %T2, label %F252 53T2: ; preds = %Merge54 call void @f3()55 ret i32 %B56 57F2: ; preds = %Merge58 ret i32 %B59}60 61declare i32 @f1()62declare i32 @f2()63declare void @f3()64 65!llvm.dbg.cu = !{!0}66!llvm.debugify = !{!2, !3}67!llvm.module.flags = !{!4}68 69!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)70!1 = !DIFile(filename: "test.ll", directory: "/")71!2 = !{i32 12}72!3 = !{i32 0}73!4 = !{i32 2, !"Debug Info Version", i32 3}74!5 = distinct !DISubprogram(name: "test1", linkageName: "test1", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, keyInstructions: true)75!6 = !DISubroutineType(types: !7)76!7 = !{}77!8 = !DILocation(line: 8, column: 1, scope: !5, atomGroup: 1, atomRank: 2)78!9 = !DILocation(line: 8, column: 1, scope: !5, atomGroup: 1, atomRank: 1)79 80