89 lines · plain
1; RUN: opt %s --passes=jump-threading -S -o - -S | FileCheck %s2 3;; +-> T1 -+4;; | v +-> T25;; Entry -+ Merge -+6;; | ^ +-> F27;; +-> F1 -+8;;9;; Duplicate Merge into T1 then fold Merge into its only pred F1 (taking its name).10;;11;; +-> T1 -----> T212;; | \ ^13;; | \ /14;; | \ /15;; Entry -+ +----+16;; | / v 17;; +--> Merge -> F218;;19;; Check the duplicated (into T1) instructions' atoms are remapped.20 21; CHECK: T1:22; CHECK-NEXT: %v1 = call i32 @f1()23; CHECK-NEXT: %cond3 = icmp eq i32 %v1, 41224; CHECK-NEXT: %C1 = add i32 %v1, 1, !dbg [[G3R2:!.*]]25; CHECK-NEXT: store i32 %C1, ptr %p, align 4, !dbg [[G3R1:!.*]]26 27; CHECK: Merge:28; CHECK-NEXT: %v2 = call i32 @f2()29; CHECK-NEXT: store i32 1, ptr %p, align 4, !dbg [[G1R1:!.*]]30; CHECK-NEXT: %C = add i32 %v2, 1, !dbg [[G2R2:!.*]]31; CHECK-NEXT: store i32 %C, ptr %p, align 4, !dbg [[G2R1:!.*]]32 33; CHECK: distinct !DISubprogram(name: "test5", {{.*}}keyInstructions: true)34; CHECK: [[G3R2]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 2)35; CHECK: [[G3R1]] = !DILocation({{.*}}, atomGroup: 3, atomRank: 1)36; CHECK: [[G1R1]] = !DILocation({{.*}}, atomGroup: 1, atomRank: 1)37; CHECK: [[G2R2]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 2)38; CHECK: [[G2R1]] = !DILocation({{.*}}, atomGroup: 2, atomRank: 1)39 40define i32 @test5(i1 %cond, i1 %cond2, ptr %p) !dbg !5 {41 br i1 %cond, label %T1, label %F142 43T1: ; preds = %044 %v1 = call i32 @f1()45 %cond3 = icmp eq i32 %v1, 41246 br label %Merge47 48F1: ; preds = %049 %v2 = call i32 @f2()50 store i32 1, ptr %p, align 4, !dbg !851 br label %Merge52 53Merge: ; preds = %F1, %T154 %A = phi i1 [ %cond3, %T1 ], [ %cond2, %F1 ]55 %B = phi i32 [ %v1, %T1 ], [ %v2, %F1 ]56 %C = add i32 %B, 1, !dbg !957 store i32 %C, ptr %p, align 4, !dbg !1058 br i1 %A, label %T2, label %F259 60T2: ; preds = %Merge61 call void @f3()62 ret i32 %B63 64F2: ; preds = %Merge65 ret i32 %B66}67 68declare i32 @f1()69 70declare i32 @f2()71 72declare void @f3()73 74!llvm.dbg.cu = !{!0}75!llvm.debugify = !{!2, !3}76!llvm.module.flags = !{!4}77 78!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)79!1 = !DIFile(filename: "test.ll", directory: "/")80!2 = !{i32 12}81!3 = !{i32 0}82!4 = !{i32 2, !"Debug Info Version", i32 3}83!5 = distinct !DISubprogram(name: "test5", linkageName: "test5", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, keyInstructions: true)84!6 = !DISubroutineType(types: !7)85!7 = !{}86!8 = !DILocation(line: 1, column: 1, scope: !5, atomGroup: 1, atomRank: 1)87!9 = !DILocation(line: 2, column: 1, scope: !5, atomGroup: 2, atomRank: 2)88!10 = !DILocation(line: 2, column: 1, scope: !5, atomGroup: 2, atomRank: 1)89