1; RUN: opt %loadPolly -basic-aa -polly-codegen -S < %s | FileCheck %s
2;
3; Verify that we remove the lifetime markers from everywhere.
4;
5; CHECK-NOT: call void @llvm.lifetime.start
6; CHECK-NOT: call void @llvm.lifetime.end
7;
8;    int A[1024];
9;    void jd() {
10;      for (int i = 0; i < 1024; i++) {
11;        int tmp[1024];
12;        for (int j = i; j < 1024; j++)
13;          tmp[i] += A[j];
14;        A[i] = tmp[i];
15;      }
16;    }
17;
18; ModuleID = 'test/Isl/CodeGen/lifetime_intrinsics.ll'
19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20
21@A = common global [1024 x i32] zeroinitializer, align 16
22
23; Function Attrs: nounwind uwtable
24define void @jd() #0 {
25entry:
26  %tmp = alloca [1024 x i32], align 16
27  %tmp3 = bitcast [1024 x i32]* %tmp to i8*
28  br label %for.cond
29
30for.cond:                                         ; preds = %for.inc11, %entry
31  %indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc11 ], [ 0, %entry ]
32  %exitcond5 = icmp ne i64 %indvars.iv3, 1024
33  br i1 %exitcond5, label %for.body, label %for.end13
34
35for.body:                                         ; preds = %for.cond
36  call void @llvm.lifetime.start(i64 4096, i8* %tmp3) #1
37  br label %for.cond2
38
39for.cond2:                                        ; preds = %for.inc, %for.body
40  %indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc ], [ %indvars.iv3, %for.body ]
41  %lftr.wideiv = trunc i64 %indvars.iv1 to i32
42  %exitcond = icmp ne i32 %lftr.wideiv, 1024
43  br i1 %exitcond, label %for.body4, label %for.end
44
45for.body4:                                        ; preds = %for.cond2
46  %arrayidx = getelementptr inbounds [1024 x i32], [1024 x i32]* @A, i64 0, i64 %indvars.iv1
47  %tmp6 = load i32, i32* %arrayidx, align 4
48  %arrayidx6 = getelementptr inbounds [1024 x i32], [1024 x i32]* %tmp, i64 0, i64 %indvars.iv3
49  %tmp7 = load i32, i32* %arrayidx6, align 4
50  %add = add nsw i32 %tmp7, %tmp6
51  store i32 %add, i32* %arrayidx6, align 4
52  br label %for.inc
53
54for.inc:                                          ; preds = %for.body4
55  %indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 1
56  br label %for.cond2
57
58for.end:                                          ; preds = %for.cond2
59  %arrayidx8 = getelementptr inbounds [1024 x i32], [1024 x i32]* %tmp, i64 0, i64 %indvars.iv3
60  %tmp8 = load i32, i32* %arrayidx8, align 4
61  %arrayidx10 = getelementptr inbounds [1024 x i32], [1024 x i32]* @A, i64 0, i64 %indvars.iv3
62  store i32 %tmp8, i32* %arrayidx10, align 4
63  call void @llvm.lifetime.end(i64 4096, i8* %tmp3) #1
64  br label %for.inc11
65
66for.inc11:                                        ; preds = %for.end
67  %indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
68  br label %for.cond
69
70for.end13:                                        ; preds = %for.cond
71  ret void
72}
73
74; Function Attrs: nounwind
75declare void @llvm.lifetime.start(i64, i8* nocapture) #1
76
77; Function Attrs: nounwind
78declare void @llvm.lifetime.end(i64, i8* nocapture) #1
79
80attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "stack-protector-buffer-size"="8" "unsafe-fp-math"="true" "use-soft-float"="false" }
81attributes #1 = { nounwind }
82