• 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; Check that we detect a scop with invariant accesses.
11; SCOP:      Function: f
12; SCOP-NEXT: Region: %entry.split---%for.end
13; SCOP-NEXT: Max Loop Depth:  1
14; SCOP-NEXT: Invariant Accesses: {
15; SCOP-NEXT:         ReadAccess :=	[Reduction Type: NONE] [Scalar: 0]
16; SCOP-NEXT:             [beginval] -> { Stmt_entry_split[] -> MemRef_begin[0] };
17; SCOP-NEXT:         Execution Context: [beginval] -> {  :  }
18; SCOP-NEXT: }
19
20; Check that the kernel launch is generated in the host IR.
21; This declaration would not have been generated unless a kernel launch exists.
22; HOST-IR: declare void @polly_launchKernel(i8*, i32, i32, i32, i32, i32, i8*)
23
24;
25; void f(int *begin, int *arr) {
26;     for (int i = *begin; i < 100; i++) {
27;         arr[i] = 0;
28;     }
29; }
30
31target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128"
32
33define void @f(i32* %begin, i32* %arr) {
34entry:
35  br label %entry.split
36
37entry.split:                                      ; preds = %entry
38  %beginval = load i32, i32* %begin, align 4
39  %cmp1 = icmp slt i32 %beginval, 100
40  br i1 %cmp1, label %for.body, label %for.end
41
42
43
44for.body:                                         ; preds = %for.body.lr.ph, %for.body
45  %ival = phi i32 [ %beginval, %entry.split ], [ %inc, %for.body ]
46  %arrayidx = getelementptr inbounds i32, i32* %arr, i32 %ival
47  store i32 0, i32* %arrayidx, align 4
48  %inc = add nsw i32 %ival, 1
49  %cmp = icmp slt i32 %ival, 99
50  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge
51
52for.cond.for.end_crit_edge:                       ; preds = %for.body
53  br label %for.end
54
55for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry.split
56  ret void
57}
58