|
| 1 | +; RUN: opt -S -passes=jump-threading,verify %s | FileCheck %s |
| 2 | + |
| 3 | +;; Modified from llvm/test/Transforms/JumpThreading/thread-two-bbs.ll |
| 4 | +;; |
| 5 | +;; JumpThreading duplicates bb.cond2 to thread through bb.file to bb.f2 or exit. |
| 6 | +;; |
| 7 | +;; Check the duplicated instructions get remapped atom groups. |
| 8 | + |
| 9 | +; CHECK: bb.cond2: |
| 10 | +; CHECK-NEXT: call void @f1() |
| 11 | +; CHECK-NEXT: %tobool1 = icmp eq i32 %cond2, 0, !dbg [[G1R2:!.*]] |
| 12 | +; CHECK-NEXT: br i1 %tobool1, label %exit, label %exit, !dbg [[G1R1:!.*]] |
| 13 | + |
| 14 | +; CHECK: bb.cond2.thread: |
| 15 | +; CHECK-NEXT: %tobool12 = icmp eq i32 %cond2, 0, !dbg [[G2R2:!.*]] |
| 16 | +; CHECK-NEXT: br i1 %tobool12, label %bb.f2, label %exit, !dbg [[G2R1:!.*]] |
| 17 | + |
| 18 | +; CHECK: [[G1R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 2) |
| 19 | +; CHECK: [[G1R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 1) |
| 20 | +; CHECK: [[G2R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 2) |
| 21 | +; CHECK: [[G2R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 1) |
| 22 | + |
| 23 | +@a = global i32 0, align 4 |
| 24 | + |
| 25 | +define void @foo(i32 %cond1, i32 %cond2) !dbg !5 { |
| 26 | +entry: |
| 27 | + %tobool = icmp eq i32 %cond1, 0 |
| 28 | + br i1 %tobool, label %bb.cond2, label %bb.f1 |
| 29 | + |
| 30 | +bb.f1: ; preds = %entry |
| 31 | + call void @f1() |
| 32 | + br label %bb.cond2 |
| 33 | + |
| 34 | +bb.cond2: ; preds = %bb.f1, %entry |
| 35 | + %ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ] |
| 36 | + %tobool1 = icmp eq i32 %cond2, 0, !dbg !9 |
| 37 | + br i1 %tobool1, label %bb.file, label %exit, !dbg !10 |
| 38 | + |
| 39 | +bb.file: ; preds = %bb.cond2 |
| 40 | + %cmp = icmp eq ptr %ptr, null |
| 41 | + br i1 %cmp, label %exit, label %bb.f2 |
| 42 | + |
| 43 | +bb.f2: ; preds = %bb.file |
| 44 | + call void @f2() |
| 45 | + br label %exit |
| 46 | + |
| 47 | +exit: ; preds = %bb.f2, %bb.file, %bb.cond2 |
| 48 | + ret void |
| 49 | +} |
| 50 | + |
| 51 | +declare void @f1() |
| 52 | + |
| 53 | +declare void @f2() |
| 54 | + |
| 55 | +!llvm.dbg.cu = !{!0} |
| 56 | +!llvm.debugify = !{!2, !3} |
| 57 | +!llvm.module.flags = !{!4} |
| 58 | + |
| 59 | +!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug) |
| 60 | +!1 = !DIFile(filename: "<stdin>", directory: "/") |
| 61 | +!2 = !{i32 16} |
| 62 | +!3 = !{i32 0} |
| 63 | +!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 64 | +!5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) |
| 65 | +!6 = !DISubroutineType(types: !7) |
| 66 | +!7 = !{} |
| 67 | +!9 = !DILocation(line: 1, column: 1, scope: !5, atomGroup: 1, atomRank: 2) |
| 68 | +!10 = !DILocation(line: 1, column: 1, scope: !5, atomGroup: 1, atomRank: 1) |
0 commit comments