llvm-project
99 строк · 3.5 Кб
1; RUN: opt %loadNPMPolly -aa-pipeline=basic-aa -passes=polly-codegen -S < %s | FileCheck %s
2;
3; Verify that we remove the misc intrinsics from the optimized SCoP.
4;
5; CHECK: for.body:
6; CHECK: call ptr @llvm.invariant.start
7; CHECK: for.body4:
8; CHECK: call void @llvm.assume
9; CHECK: call i1 @llvm.expect.i1
10; CHECK: call void @llvm.donothing
11; CHECK: for.end:
12; CHECK: call void @llvm.invariant.end
13; CHECK-NOT: call void @llvm.{{.*}}
14;
15; int A[1024];
16; void jd() {
17; for (int i = 0; i < 1024; i++) {
18; int tmp[1024];
19; for (int j = i; j < 1024; j++)
20; tmp[i] += A[j];
21; A[i] = tmp[i];
22; }
23; }
24;
25; ModuleID = 'test/Isl/CodeGen/lifetime_intrinsics.ll'
26target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
27
28@A = common global [1024 x i32] zeroinitializer, align 16
29
30; Function Attrs: nounwind uwtable
31define void @jd() #0 {
32entry:
33%tmp = alloca [1024 x i32], align 16
34br label %for.cond
35
36for.cond: ; preds = %for.inc11, %entry
37%indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc11 ], [ 0, %entry ]
38%exitcond5 = icmp ne i64 %indvars.iv3, 1024
39br i1 %exitcond5, label %for.body, label %for.end13
40
41for.body: ; preds = %for.cond
42%lis = call ptr @llvm.invariant.start(i64 4096, ptr @A) #1
43br label %for.cond2
44
45for.cond2: ; preds = %for.inc, %for.body
46%indvars.iv1 = phi i64 [ %indvars.iv.next2, %for.inc ], [ %indvars.iv3, %for.body ]
47%lftr.wideiv = trunc i64 %indvars.iv1 to i32
48%exitcond = icmp ne i32 %lftr.wideiv, 1024
49br i1 %exitcond, label %for.body4, label %for.end
50
51for.body4: ; preds = %for.cond2
52call void @llvm.assume(i1 %exitcond)
53call i1 @llvm.expect.i1(i1 %exitcond, i1 1)
54%arrayidx = getelementptr inbounds [1024 x i32], ptr @A, i64 0, i64 %indvars.iv1
55%tmp6 = load i32, ptr %arrayidx, align 4
56%arrayidx6 = getelementptr inbounds [1024 x i32], ptr %tmp, i64 0, i64 %indvars.iv3
57call void @llvm.donothing()
58%tmp7 = load i32, ptr %arrayidx6, align 4
59%add = add nsw i32 %tmp7, %tmp6
60store i32 %add, ptr %arrayidx6, align 4
61br label %for.inc
62
63for.inc: ; preds = %for.body4
64%indvars.iv.next2 = add nuw nsw i64 %indvars.iv1, 1
65br label %for.cond2
66
67for.end: ; preds = %for.cond2
68%arrayidx8 = getelementptr inbounds [1024 x i32], ptr %tmp, i64 0, i64 %indvars.iv3
69%tmp8 = load i32, ptr %arrayidx8, align 4
70%arrayidx10 = getelementptr inbounds [1024 x i32], ptr @A, i64 0, i64 %indvars.iv3
71call void @llvm.invariant.end(ptr %lis, i64 4096, ptr @A) #1
72store i32 %tmp8, ptr %arrayidx10, align 4
73br label %for.inc11
74
75for.inc11: ; preds = %for.end
76%indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
77br label %for.cond
78
79for.end13: ; preds = %for.cond
80ret void
81}
82
83; Function Attrs: nounwind
84declare void @llvm.donothing() #1
85
86; Function Attrs: nounwind
87declare void @llvm.assume(i1) #1
88
89; Function Attrs: nounwind
90declare i1 @llvm.expect.i1(i1, i1) #1
91
92; Function Attrs: nounwind
93declare ptr @llvm.invariant.start(i64, ptr nocapture) #1
94
95; Function Attrs: nounwind
96declare void @llvm.invariant.end(ptr, i64, ptr nocapture) #1
97
98attributes #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" }
99attributes #1 = { nounwind }
100