1 ; Test that the lazy value analysis gets invalidated when its dependencies go
2 ; away. Sadly, you can neither print nor verify LVI so we just have to require
3 ; it and check that the pass manager does the right thing.
5 ; Check basic invalidation.
6 ; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \
7 ; RUN: -passes='require<lazy-value-info>,invalidate<lazy-value-info>,require<lazy-value-info>' \
8 ; RUN: | FileCheck %s --check-prefix=CHECK-INVALIDATE
9 ; CHECK-INVALIDATE: Running pass: RequireAnalysisPass
10 ; CHECK-INVALIDATE: Running analysis: LazyValueAnalysis
11 ; CHECK-INVALIDATE: Running pass: InvalidateAnalysisPass
12 ; CHECK-INVALIDATE: Invalidating analysis: LazyValueAnalysis
13 ; CHECK-INVALIDATE: Running pass: RequireAnalysisPass
14 ; CHECK-INVALIDATE: Running analysis: LazyValueAnalysis
16 target triple = "x86_64-unknown-linux-gnu"
18 @.str = private unnamed_addr constant [8 x i8] c"a = %l\0A\00", align 1
20 declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
22 declare void @hoo(i64*)
24 declare i32 @printf(i8* nocapture readonly, ...)
26 declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
28 define void @goo(i32 %N, i64* %b) {
30 %a.i = alloca i64, align 8
31 %tmp = bitcast i64* %a.i to i8*
32 %c = getelementptr inbounds i64, i64* %b, i64 0
35 for.cond: ; preds = %for.body, %entry
36 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
37 %cmp = icmp slt i32 %i.0, %N
38 br i1 %cmp, label %for.body, label %for.end
40 for.body: ; preds = %for.cond
41 call void @llvm.lifetime.start.p0i8(i64 8, i8* %tmp)
42 call void @hoo(i64* %a.i)
43 call void @hoo(i64* %c)
44 %tmp1 = load volatile i64, i64* %a.i, align 8
45 %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %tmp1)
46 call void @llvm.lifetime.end.p0i8(i64 8, i8* %tmp)
47 %inc = add nsw i32 %i.0, 1
50 for.end: ; preds = %for.cond