• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -correlated-propagation -debug-only=lazy-value-info <%s 2>&1 | FileCheck %s
2; REQUIRES: asserts
3;
4; Shortcut in Correlated Value Propagation ensures not to take Lazy Value Info
5; analysis for %a.i and %tmp because %a.i is defined by alloca and %tmp is
6; defined by alloca + bitcast. We know the ret value of alloca is nonnull.
7;
8; CHECK-NOT: LVI Getting edge value   %a.i = alloca i64, align 8 at 'for.body'
9; CHECK-NOT: LVI Getting edge value   %tmp = bitcast i64* %a.i to i8* from 'for.cond' to 'for.body'
10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
11target triple = "x86_64-unknown-linux-gnu"
12
13@.str = private unnamed_addr constant [8 x i8] c"a = %l\0A\00", align 1
14
15; Function Attrs: argmemonly nounwind
16declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
17
18declare void @hoo(i64*)
19
20declare i32 @printf(i8* nocapture readonly, ...)
21
22; Function Attrs: argmemonly nounwind
23declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
24
25define void @goo(i32 %N, i64* %b) {
26entry:
27  %a.i = alloca i64, align 8
28  %tmp = bitcast i64* %a.i to i8*
29  %c = getelementptr inbounds i64, i64* %b, i64 0
30  br label %for.cond
31
32for.cond:                                         ; preds = %for.body, %entry
33  %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
34  %cmp = icmp slt i32 %i.0, %N
35  br i1 %cmp, label %for.body, label %for.end
36
37for.body:                                         ; preds = %for.cond
38  call void @llvm.lifetime.start.p0i8(i64 8, i8* %tmp)
39  call void @hoo(i64* %a.i)
40  call void @hoo(i64* %c)
41  %tmp1 = load volatile i64, i64* %a.i, align 8
42  %call.i = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %tmp1)
43  call void @llvm.lifetime.end.p0i8(i64 8, i8* %tmp)
44  %inc = add nsw i32 %i.0, 1
45  br label %for.cond
46
47for.end:                                          ; preds = %for.cond
48  ret void
49}
50