brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.4 KiB · 175272e Raw
86 lines · plain
1; RUN: opt -S -passes=jump-threading,verify %s | FileCheck %s2 3;; Modified from llvm/test/Transforms/JumpThreading/thread-two-bbs.ll4;;5;; JumpThreading duplicates bb.cond2 to thread through bb.file to bb.file,6;; bb.f2 or exit.7;;8;; Check the duplicated instructions get remapped atom groups.9 10; CHECK: bb.cond2:11; CHECK-NEXT: call void @f1()12; CHECK-NEXT: %tobool1 = icmp eq i32 %cond2, 0, !dbg [[G1R2:!.*]]13; CHECK-NEXT: br i1 %tobool1, label %bb.file, label %exit, !dbg [[G1R1:!.*]]14 15; CHECK: bb.cond2.thread:16; CHECK-NEXT: %tobool12 = icmp eq i32 %cond2, 0, !dbg [[G3R2:!.*]]17; CHECK-NEXT: br i1 %tobool12, label %bb.f2, label %exit, !dbg [[G3R1:!.*]]18 19;; After the transform %ptr is null through bb.cond2 and @a through20;; bb.cond2.thread. Thread bb.cond2.thread->bb.f2 through bb.file.21;; Check the duplicated store gets a remapped atom group too.22 23; CHECK: bb.file:24; CHECK-NEXT: %ptr3 = phi ptr [ null, %bb.cond2 ]25; CHECK-NEXT: store ptr %ptr3, ptr %p, align 4, !dbg [[G2R1:!.*]]26 27; CHECK: bb.f2:28; CHECK-NEXT: store ptr @a, ptr %p, align 4, !dbg [[G4R1:!.*]]29 30; CHECK: distinct !DISubprogram(name: "foo", {{.*}}keyInstructions: true)31; CHECK: [[G1R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 2)32; CHECK: [[G1R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 1, atomRank: 1)33; CHECK: [[G3R2]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 3, atomRank: 2)34; CHECK: [[G3R1]] = !DILocation(line: 1, column: 1, scope: ![[#]], atomGroup: 3, atomRank: 1)35; CHECK: [[G2R1]] = !DILocation(line: 2, column: 1, scope: ![[#]], atomGroup: 2, atomRank: 1)36; CHECK: [[G4R1]] = !DILocation(line: 2, column: 1, scope: ![[#]], atomGroup: 4, atomRank: 1)37 38@a = global i32 0, align 439 40define void @foo(i32 %cond1, i32 %cond2, ptr %p) !dbg !5 {41entry:42  %tobool = icmp eq i32 %cond1, 043  br i1 %tobool, label %bb.cond2, label %bb.f144 45bb.f1:                                            ; preds = %entry46  call void @f1()47  br label %bb.cond248 49bb.cond2:                                         ; preds = %bb.f1, %entry50  %ptr = phi ptr [ null, %bb.f1 ], [ @a, %entry ]51  %tobool1 = icmp eq i32 %cond2, 0, !dbg !952  br i1 %tobool1, label %bb.file, label %exit, !dbg !1053 54bb.file:                                          ; preds = %bb.cond255  store ptr %ptr, ptr %p, align 4, !dbg !1156  %cmp = icmp eq ptr %ptr, null57  br i1 %cmp, label %exit, label %bb.f258 59bb.f2:                                            ; preds = %bb.file60  call void @f2()61  br label %exit62 63exit:                                             ; preds = %bb.f2, %bb.file, %bb.cond264  ret void65}66 67declare void @f1()68 69declare void @f2()70 71!llvm.dbg.cu = !{!0}72!llvm.debugify = !{!2, !3}73!llvm.module.flags = !{!4}74 75!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)76!1 = !DIFile(filename: "<stdin>", directory: "/")77!2 = !{i32 16}78!3 = !{i32 0}79!4 = !{i32 2, !"Debug Info Version", i32 3}80!5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, keyInstructions: true)81!6 = !DISubroutineType(types: !7)82!7 = !{}83!9 = !DILocation(line: 1, column: 1, scope: !5, atomGroup: 1, atomRank: 2)84!10 = !DILocation(line: 1, column: 1, scope: !5, atomGroup: 1, atomRank: 1)85!11 = !DILocation(line: 2, column: 1, scope: !5, atomGroup: 2, atomRank: 1)86