brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 643cf65 Raw
81 lines · plain
1; This test exercises that we don't corrupt a loop-analysis when running loop2; unrolling in a way that deletes a loop. To do that, we first ensure the3; analysis is cached, then unroll the loop (deleting it) and make sure that the4; next function doesn't get a cache "hit" for this stale analysis result.5;6; RUN: opt -S -passes='require<access-info>,loop-unroll,print<access-info>' -debug-pass-manager < %s 2>&1 | FileCheck %s7;8; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis9; CHECK: Running analysis: LoopAnalysis10; CHECK: Running pass: LoopUnrollPass11; CHECK: Invalidating analysis: LoopAccessAnalysis on test12; CHECK: Running pass: LoopAccessInfoPrinterPass13; CHECK: Running analysis: LoopAccessAnalysis on test14; CHECK: Printing analysis 'Loop Access Analysis' for function 'test':15; CHECK:   inner1.header:16 17; CHECK:   inner1.header.1:18 19target triple = "x86_64-unknown-linux-gnu"20 21define void @test(i32 %inner1.count) {22; CHECK-LABEL: define void @test(23bb:24  br label %outer.ph25 26outer.ph:27  br label %outer.header28 29outer.header:30  %outer.i = phi i32 [ 0, %outer.ph ], [ %outer.i.next, %outer.latch ]31  br label %inner1.ph32 33inner1.ph:34  br label %inner1.header35 36inner1.header:37  %inner1.i = phi i32 [ 0, %inner1.ph ], [ %inner1.i.next, %inner1.header ]38  %inner1.i.next = add i32 %inner1.i, 139  %inner1.cond = icmp eq i32 %inner1.i, %inner1.count40  br i1 %inner1.cond, label %inner1.exit, label %inner1.header41; We should have two unrolled copies of this loop and nothing else.42;43; CHECK-NOT:     icmp eq44; CHECK-NOT:     br i145; CHECK:         %[[COND1:.*]] = icmp eq i32 %{{.*}}, %inner1.count46; CHECK:         br i1 %[[COND1]],47; CHECK-NOT:     icmp eq48; CHECK-NOT:     br i149; CHECK:         %[[COND2:.*]] = icmp eq i32 %{{.*}}, %inner1.count50; CHECK:         br i1 %[[COND2]],51; CHECK-NOT:     icmp eq52; CHECK-NOT:     br i153 54 55inner1.exit:56  br label %inner2.ph57 58inner2.ph:59  br label %inner2.header60 61inner2.header:62  %inner2.i = phi i32 [ 0, %inner2.ph ], [ %inner2.i.next, %inner2.header ]63  %inner2.i.next = add i32 %inner2.i, 164  %inner2.cond = icmp eq i32 %inner2.i, 465  br i1 %inner2.cond, label %inner2.exit, label %inner2.header66 67inner2.exit:68  br label %outer.latch69 70outer.latch:71  %outer.i.next = add i32 %outer.i, 172  %outer.cond = icmp eq i32 %outer.i.next, 273  br i1 %outer.cond, label %outer.exit, label %outer.header74 75outer.exit:76  br label %exit77 78exit:79  ret void80}81