1; RUN: opt %loadPolly -polly-detect -analyze \
2; RUN:     -polly-process-unprofitable=false < %s | FileCheck %s
3
4; CHECK: Valid Region for Scop: next => bb3
5;
6;    void foo(float A[], long p) {
7;      for (long x = 0; x < 1024; x++) {
8;        __sync_synchronize();
9;        if (p >= 0) {
10;          for (long i = 0; i < 1024; i++)
11;            for (long j = 0; j < 1024; j++)
12;              A[i + j] += j;
13;        }
14;      }
15;    }
16;
17target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18target triple = "x86_64-pc-linux-gnu"
19
20define void @foo(float* %A, i64 %p) {
21bb:
22  br label %bb3
23
24bb3:                                              ; preds = %bb25, %bb
25  %x.0 = phi i64 [ 0, %bb ], [ %tmp26, %bb25 ]
26  %exitcond2 = icmp ne i64 %x.0, 1024
27  br i1 %exitcond2, label %bb5, label %bb4
28
29bb4:                                              ; preds = %bb3
30  br label %bb27
31
32bb5:                                              ; preds = %bb3
33  fence seq_cst
34  br label %next
35
36next:
37  %tmp = icmp sgt i64 %p, -1
38  br i1 %tmp, label %bb6, label %bb24
39
40bb6:                                              ; preds = %bb5
41  br label %bb7
42
43bb7:                                              ; preds = %bb21, %bb6
44  %i.0 = phi i64 [ 0, %bb6 ], [ %tmp22, %bb21 ]
45  %exitcond1 = icmp ne i64 %i.0, 1024
46  br i1 %exitcond1, label %bb9, label %bb8
47
48bb8:                                              ; preds = %bb7
49  br label %bb23
50
51bb9:                                              ; preds = %bb7
52  br label %bb10
53
54bb10:                                             ; preds = %bb18, %bb9
55  %j.0 = phi i64 [ 0, %bb9 ], [ %tmp19, %bb18 ]
56  %exitcond = icmp ne i64 %j.0, 1024
57  br i1 %exitcond, label %bb12, label %bb11
58
59bb11:                                             ; preds = %bb10
60  br label %bb20
61
62bb12:                                             ; preds = %bb10
63  %tmp13 = sitofp i64 %j.0 to float
64  %tmp14 = add nuw nsw i64 %i.0, %j.0
65  %tmp15 = getelementptr inbounds float, float* %A, i64 %tmp14
66  %tmp16 = load float, float* %tmp15, align 4
67  %tmp17 = fadd float %tmp16, %tmp13
68  store float %tmp17, float* %tmp15, align 4
69  br label %bb18
70
71bb18:                                             ; preds = %bb12
72  %tmp19 = add nuw nsw i64 %j.0, 1
73  br label %bb10
74
75bb20:                                             ; preds = %bb11
76  br label %bb21
77
78bb21:                                             ; preds = %bb20
79  %tmp22 = add nuw nsw i64 %i.0, 1
80  br label %bb7
81
82bb23:                                             ; preds = %bb8
83  br label %bb24
84
85bb24:                                             ; preds = %bb23, %bb5
86  br label %bb25
87
88bb25:                                             ; preds = %bb24
89  %tmp26 = add nuw nsw i64 %x.0, 1
90  br label %bb3
91
92bb27:                                             ; preds = %bb4
93  ret void
94}
95