brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 0ad1a33 Raw
53 lines · plain
1; Test that the lazy value analysis gets invalidated when its dependencies go2; away. Sadly, you can neither print nor verify LVI so we just have to require3; 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-INVALIDATE9; CHECK-INVALIDATE: Running pass: RequireAnalysisPass10; CHECK-INVALIDATE: Running analysis: LazyValueAnalysis11; CHECK-INVALIDATE: Running pass: InvalidateAnalysisPass12; CHECK-INVALIDATE: Invalidating analysis: LazyValueAnalysis13; CHECK-INVALIDATE: Running pass: RequireAnalysisPass14; CHECK-INVALIDATE: Running analysis: LazyValueAnalysis15 16target triple = "x86_64-unknown-linux-gnu"17 18@.str = private unnamed_addr constant [8 x i8] c"a = %l\0A\00", align 119 20declare void @llvm.lifetime.start.p0(ptr nocapture)21 22declare void @hoo(ptr)23 24declare i32 @printf(ptr nocapture readonly, ...)25 26declare void @llvm.lifetime.end.p0(ptr nocapture)27 28define void @goo(i32 %N, ptr %b) {29entry:30  %a.i = alloca i64, align 831  %tmp = bitcast ptr %a.i to ptr32  %c = getelementptr inbounds i64, ptr %b, i64 033  br label %for.cond34 35for.cond:                                         ; preds = %for.body, %entry36  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]37  %cmp = icmp slt i32 %i.0, %N38  br i1 %cmp, label %for.body, label %for.end39 40for.body:                                         ; preds = %for.cond41  call void @llvm.lifetime.start.p0(ptr %tmp)42  call void @hoo(ptr %a.i)43  call void @hoo(ptr %c)44  %tmp1 = load volatile i64, ptr %a.i, align 845  %call.i = call i32 (ptr, ...) @printf(ptr @.str, i64 %tmp1)46  call void @llvm.lifetime.end.p0(ptr %tmp)47  %inc = add nsw i32 %i.0, 148  br label %for.cond49 50for.end:                                          ; preds = %for.cond51  ret void52}53