xref: /llvm-project/polly/test/ScopInfo/NonAffine/modulo_domain.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=print<polly-function-scops>' -disable-output < %s 2>&1 | FileCheck %s
2;
3; TODO: The new domain generation cannot handle modulo domain constraints,
4;       hence modulo handling has been disabled completely. Once this is
5;       resolved this test should work again. Until then we approximate the
6;       whole loop body.
7;
8; CHECK:   Domain :=
9; CHECK:       { Stmt_for_body[i0] : 0 <= i0 <= 15 };
10;
11;    void foo(float *A) {
12;      for (long i = 0; i < 16; i++) {
13;        A[i] += 1;
14;        if (i % 2)
15;          A[i] += 2;
16;      }
17;    }
18;
19target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
20
21define void @foo(ptr %A) {
22entry:
23  br label %for.cond
24
25for.cond:                                         ; preds = %for.inc, %entry
26  %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.inc ]
27  %exitcond = icmp ne i64 %i.0, 16
28  br i1 %exitcond, label %for.body, label %for.end
29
30for.body:                                         ; preds = %for.cond
31  %arrayidx0 = getelementptr inbounds float, ptr %A, i64 %i.0
32  %tmp0 = load float, ptr %arrayidx0, align 4
33  %add0 = fadd float %tmp0, 2.000000e+00
34  store float %add0, ptr %arrayidx0, align 4
35  %rem1 = srem i64 %i.0, 2
36  %tobool = icmp eq i64 %rem1, 0
37  br i1 %tobool, label %if.end, label %if.then
38
39if.then:                                          ; preds = %for.body
40  %arrayidx = getelementptr inbounds float, ptr %A, i64 %i.0
41  %tmp = load float, ptr %arrayidx, align 4
42  %add = fadd float %tmp, 2.000000e+00
43  store float %add, ptr %arrayidx, align 4
44  br label %if.end
45
46if.end:                                           ; preds = %for.body, %if.then
47  br label %for.inc
48
49for.inc:                                          ; preds = %if.end
50  %inc = add nuw nsw i64 %i.0, 1
51  br label %for.cond
52
53for.end:                                          ; preds = %for.cond
54  ret void
55}
56