• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -analyze -polly-use-llvm-names -polly-scops \
2; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=SCOP
3
4
5; RUN: opt %loadPolly -S -polly-use-llvm-names -polly-codegen-ppcg \
6; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=HOST-IR
7
8; REQUIRES: pollyacc
9
10; SCOP:      Function: f
11; SCOP-NEXT: Region: %entry.split---%for.end
12; SCOP-NEXT: Max Loop Depth:  1
13; SCOP-NEXT: Invariant Accesses: {
14; SCOP-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
15; SCOP-NEXT:             [tmp1, tmp4] -> { Stmt_entry_split[] -> MemRef_begin[0] };
16; SCOP-NEXT:         Execution Context: [tmp1, tmp4] -> {  :  }
17; SCOP-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
18; SCOP-NEXT:             [tmp1, tmp4] -> { Stmt_for_body[i0] -> MemRef_end[0] };
19; SCOP-NEXT:         Execution Context: [tmp1, tmp4] -> {  :  }
20; SCOP-NEXT: }
21
22
23; Check that the kernel launch is generated in the host IR.
24; This declaration would not have been generated unless a kernel launch exists.
25; HOST-IR: declare void @polly_launchKernel(i8*, i32, i32, i32, i32, i32, i8*)
26
27;    void f(int *begin, int *end, int *arr) {
28;      for (int i = *begin; i < *end; i++) {
29;        arr[i] = 0;
30;      }
31;    }
32;
33
34target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
35
36define void @f(i32* %begin, i32* %end, i32* %arr) {
37entry:
38  br label %entry.split
39
40entry.split:                                      ; preds = %entry
41  %tmp1 = load i32, i32* %begin, align 4
42  %tmp41 = load i32, i32* %end, align 4
43  %cmp2 = icmp slt i32 %tmp1, %tmp41
44  br i1 %cmp2, label %for.body.lr.ph, label %for.end
45
46for.body.lr.ph:                                   ; preds = %entry.split
47  br label %for.body
48
49for.body:                                         ; preds = %for.body.lr.ph, %for.body
50  %i.03 = phi i32 [ %tmp1, %for.body.lr.ph ], [ %inc, %for.body ]
51  %arrayidx = getelementptr inbounds i32, i32* %arr, i32 %i.03
52  store i32 0, i32* %arrayidx, align 4
53  %inc = add nsw i32 %i.03, 1
54  %tmp4 = load i32, i32* %end, align 4
55  %cmp = icmp slt i32 %inc, %tmp4
56  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
57
58for.cond.for.end_crit_edge:                       ; preds = %for.body
59  br label %for.end
60
61for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry.split
62  ret void
63}
64