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='loop(require<access-info>),loop-unroll,loop(print-access-info)' -debug-pass-manager < %s 2>&1 | FileCheck %s
8 ; CHECK: Running analysis: LoopAnalysis
9 ; CHECK: Running analysis: InnerAnalysisManagerProxy<
10 ; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
11 ; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 2 containing: %inner1.header
12 ; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
13 ; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 2 containing: %inner2.header
14 ; CHECK: Running pass: RequireAnalysisPass<{{.*}}LoopAccessAnalysis
15 ; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %outer.header
16 ; CHECK: Running pass: LoopUnrollPass
17 ; CHECK: Clearing all analysis results for: inner2.header
18 ; CHECK: Clearing all analysis results for: outer.header
19 ; CHECK: Invalidating analysis: LoopAccessAnalysis on {{.*}}inner1.header
20 ; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on {{.*}}inner1.header.1
21 ; CHECK: Running pass: LoopAccessInfoPrinterPass
22 ; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header
23 ; CHECK: Loop access info in function 'test':
24 ; CHECK: inner1.header:
25 ; CHECK: Running pass: LoopAccessInfoPrinterPass
26 ; CHECK: Running analysis: LoopAccessAnalysis on Loop at depth 1 containing: %inner1.header.1
27 ; CHECK: Loop access info in function 'test':
28 ; CHECK: inner1.header.1:
30 target triple = "x86_64-unknown-linux-gnu"
32 define void @test(i32 %inner1.count) {
33 ; CHECK-LABEL: define void @test(
38 br label %outer.header
41 %outer.i = phi i32 [ 0, %outer.ph ], [ %outer.i.next, %outer.latch ]
45 br label %inner1.header
48 %inner1.i = phi i32 [ 0, %inner1.ph ], [ %inner1.i.next, %inner1.header ]
49 %inner1.i.next = add i32 %inner1.i, 1
50 %inner1.cond = icmp eq i32 %inner1.i, %inner1.count
51 br i1 %inner1.cond, label %inner1.exit, label %inner1.header
52 ; We should have two unrolled copies of this loop and nothing else.
56 ; CHECK: %[[COND1:.*]] = icmp eq i32 %{{.*}}, %inner1.count
57 ; CHECK: br i1 %[[COND1]],
60 ; CHECK: %[[COND2:.*]] = icmp eq i32 %{{.*}}, %inner1.count
61 ; CHECK: br i1 %[[COND2]],
70 br label %inner2.header
73 %inner2.i = phi i32 [ 0, %inner2.ph ], [ %inner2.i.next, %inner2.header ]
74 %inner2.i.next = add i32 %inner2.i, 1
75 %inner2.cond = icmp eq i32 %inner2.i, 4
76 br i1 %inner2.cond, label %inner2.exit, label %inner2.header
82 %outer.i.next = add i32 %outer.i, 1
83 %outer.cond = icmp eq i32 %outer.i.next, 2
84 br i1 %outer.cond, label %outer.exit, label %outer.header