1 ; This test exercises that we don't corrupt a loop-analysis when running loop
2 ; unrolling in a way that deletes a loop. To do that, we first ensure the
3 ; analysis is cached, then unroll the loop (deleting it) and make sure that the
4 ; next function doesn't get a cache "hit" for this stale analysis result.
6 ; RUN: opt -S -passes='require<access-info>,loop-unroll,print<access-info>' -debug-pass-manager < %s 2>&1 | FileCheck %s
8 ; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
9 ; CHECK: Running analysis: LoopAnalysis
10 ; CHECK: Running pass: LoopUnrollPass
11 ; CHECK: Invalidating analysis: LoopAccessAnalysis on test
12 ; CHECK: Running pass: LoopAccessInfoPrinterPass
13 ; CHECK: Running analysis: LoopAccessAnalysis on test
14 ; CHECK: Printing analysis 'Loop Access Analysis' for function 'test':
15 ; CHECK: inner1.header:
17 ; CHECK: inner1.header.1:
19 target triple = "x86_64-unknown-linux-gnu"
21 define void @test(i32 %inner1.count) {
22 ; CHECK-LABEL: define void @test(
27 br label %outer.header
30 %outer.i = phi i32 [ 0, %outer.ph ], [ %outer.i.next, %outer.latch ]
34 br label %inner1.header
37 %inner1.i = phi i32 [ 0, %inner1.ph ], [ %inner1.i.next, %inner1.header ]
38 %inner1.i.next = add i32 %inner1.i, 1
39 %inner1.cond = icmp eq i32 %inner1.i, %inner1.count
40 br i1 %inner1.cond, label %inner1.exit, label %inner1.header
41 ; We should have two unrolled copies of this loop and nothing else.
45 ; CHECK: %[[COND1:.*]] = icmp eq i32 %{{.*}}, %inner1.count
46 ; CHECK: br i1 %[[COND1]],
49 ; CHECK: %[[COND2:.*]] = icmp eq i32 %{{.*}}, %inner1.count
50 ; CHECK: br i1 %[[COND2]],
59 br label %inner2.header
62 %inner2.i = phi i32 [ 0, %inner2.ph ], [ %inner2.i.next, %inner2.header ]
63 %inner2.i.next = add i32 %inner2.i, 1
64 %inner2.cond = icmp eq i32 %inner2.i, 4
65 br i1 %inner2.cond, label %inner2.exit, label %inner2.header
71 %outer.i.next = add i32 %outer.i, 1
72 %outer.cond = icmp eq i32 %outer.i.next, 2
73 br i1 %outer.cond, label %outer.exit, label %outer.header