• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -analyze -polly-scops < %s | FileCheck %s --check-prefix=SCOP
2; RUN: opt %loadPolly -S -polly-codegen-ppcg < %s | FileCheck %s
3
4; Check that we do not create a kernel if there is an
5; unknown function call in a candidate kernel.
6
7; Check that we model the kernel as a scop.
8; SCOP:      Function: f
9; SCOP-NEXT:     Region: %entry.split---%for.end13
10
11; If a kernel were generated, then this code would have been part of the kernel
12; and not the `.ll` file that is generated.
13; CHECK:       %conv = fpext float %0 to double
14; CHECK-NEXT:  %1 = tail call double @extern.fn(double %conv)
15; CHECK-NEXT:  %conv6 = fptrunc double %1 to float
16
17; REQUIRES: pollyacc
18
19; static const int N = 1000;
20; void f(float A[N][N], int n, float B[N][N]) {
21;   for(int i = 0; i < n; i++) {
22;     for(int j = 0; j < n; j++) {
23;       B[i][j] = extern_fn(A[i][j], 3);
24;     }
25;
26;   }
27; }
28
29target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
30target triple = "x86_64-apple-macosx10.11.0"
31
32define void @f([1000 x float]* %A, i32 %n, [1000 x float]* %B) {
33entry:
34  br label %entry.split
35
36entry.split:                                      ; preds = %entry
37  %cmp3 = icmp sgt i32 %n, 0
38  br i1 %cmp3, label %for.cond1.preheader.lr.ph, label %for.end13
39
40for.cond1.preheader.lr.ph:                        ; preds = %entry.split
41  br label %for.cond1.preheader
42
43for.cond1.preheader:                              ; preds = %for.cond1.preheader.lr.ph, %for.inc11
44  %indvars.iv5 = phi i64 [ 0, %for.cond1.preheader.lr.ph ], [ %indvars.iv.next6, %for.inc11 ]
45  %cmp21 = icmp sgt i32 %n, 0
46  br i1 %cmp21, label %for.body3.lr.ph, label %for.inc11
47
48for.body3.lr.ph:                                  ; preds = %for.cond1.preheader
49  br label %for.body3
50
51for.body3:                                        ; preds = %for.body3.lr.ph, %for.body3
52  %indvars.iv = phi i64 [ 0, %for.body3.lr.ph ], [ %indvars.iv.next, %for.body3 ]
53  %arrayidx5 = getelementptr inbounds [1000 x float], [1000 x float]* %A, i64 %indvars.iv5, i64 %indvars.iv
54  %0 = load float, float* %arrayidx5, align 4
55  %conv = fpext float %0 to double
56  %1 = tail call double @extern.fn(double %conv)
57  %conv6 = fptrunc double %1 to float
58  %arrayidx10 = getelementptr inbounds [1000 x float], [1000 x float]* %B, i64 %indvars.iv5, i64 %indvars.iv
59  store float %conv6, float* %arrayidx10, align 4
60  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
61  %wide.trip.count = zext i32 %n to i64
62  %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
63  br i1 %exitcond, label %for.body3, label %for.cond1.for.inc11_crit_edge
64
65for.cond1.for.inc11_crit_edge:                    ; preds = %for.body3
66  br label %for.inc11
67
68for.inc11:                                        ; preds = %for.cond1.for.inc11_crit_edge, %for.cond1.preheader
69  %indvars.iv.next6 = add nuw nsw i64 %indvars.iv5, 1
70  %wide.trip.count7 = zext i32 %n to i64
71  %exitcond8 = icmp ne i64 %indvars.iv.next6, %wide.trip.count7
72  br i1 %exitcond8, label %for.cond1.preheader, label %for.cond.for.end13_crit_edge
73
74for.cond.for.end13_crit_edge:                     ; preds = %for.inc11
75  br label %for.end13
76
77for.end13:                                        ; preds = %for.cond.for.end13_crit_edge, %entry.split
78  ret void
79}
80
81declare double @extern.fn(double) #0
82attributes #0 = { readnone }
83