llvm-project
67 строк · 1.2 Кб
1; RUN: opt %loadNPMPolly '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s
2
3; void f(long A[], long N) {
4; long i;
5;
6; if (true){
7; i = 0;
8; goto next;
9; }else{
10; i = 1;
11; goto next;
12; }
13;
14; next:
15; if (true)
16; goto for.i;
17; else
18; goto for.i;
19;
20; for.i:
21; for (i = 0; i < N; ++i)
22; A[i] = i;
23; }
24
25target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
26
27define void @f(ptr %A, i64 %N) nounwind {
28entry:
29fence seq_cst
30br i1 true, label %then1, label %else1
31
32then1:
33br label %next
34
35else1:
36br label %next
37
38next:
39br i1 true, label %then, label %else
40
41then:
42br label %for.i.head
43
44else:
45br label %for.i.head
46
47for.i.head:
48br label %for.i.head1
49
50for.i.head1:
51br label %for.i
52
53for.i:
54%indvar = phi i64 [ 0, %for.i.head1], [ %indvar.next, %for.i ]
55fence seq_cst
56%scevgep = getelementptr i64, ptr %A, i64 %indvar
57store i64 %indvar, ptr %scevgep
58%indvar.next = add nsw i64 %indvar, 1
59%exitcond = icmp eq i64 %indvar.next, %N
60br i1 %exitcond, label %return, label %for.i
61
62return:
63fence seq_cst
64ret void
65}
66
67; CHECK: Valid Region for Scop: next => for.i
68