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. 4; 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 15; 16; Check DomTree specifically. 17; RUN: opt -disable-output -disable-verify -debug-pass-manager %s 2>&1 \ 18; RUN: -passes='require<domtree>,require<lazy-value-info>,invalidate<domtree>,require<lazy-value-info>' \ 19; RUN: | FileCheck %s --check-prefix=CHECK-DT-INVALIDATE 20; CHECK-DT-INVALIDATE: Running pass: RequireAnalysisPass 21; CHECK-DT-INVALIDATE: Running analysis: LazyValueAnalysis 22; CHECK-DT-INVALIDATE: Running pass: InvalidateAnalysisPass 23; CHECK-DT-INVALIDATE: Invalidating analysis: DominatorTreeAnalysis 24; CHECK-DT-INVALIDATE: Invalidating analysis: LazyValueAnalysis 25; CHECK-AC-INVALIDATE: Running pass: RequireAnalysisPass 26; CHECK-DT-INVALIDATE: Running analysis: LazyValueAnalysis 27 28target triple = "x86_64-unknown-linux-gnu" 29 30@.str = private unnamed_addr constant [8 x i8] c"a = %l\0A\00", align 1 31 32declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) 33 34declare void @hoo(i64*) 35 36declare i32 @printf(i8* nocapture readonly, ...) 37 38declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) 39 40define void @goo(i32 %N, i64* %b) { 41entry: 42 %a.i = alloca i64, align 8 43 %tmp = bitcast i64* %a.i to i8* 44 %c = getelementptr inbounds i64, i64* %b, i64 0 45 br label %for.cond 46 47for.cond: ; preds = %for.body, %entry 48 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] 49 %cmp = icmp slt i32 %i.0, %N 50 br i1 %cmp, label %for.body, label %for.end 51 52for.body: ; preds = %for.cond 53 call void @llvm.lifetime.start.p0i8(i64 8, i8* %tmp) 54 call void @hoo(i64* %a.i) 55 call void @hoo(i64* %c) 56 %tmp1 = load volatile i64, i64* %a.i, align 8 57 %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %tmp1) 58 call void @llvm.lifetime.end.p0i8(i64 8, i8* %tmp) 59 %inc = add nsw i32 %i.0, 1 60 br label %for.cond 61 62for.end: ; preds = %for.cond 63 ret void 64} 65