xref: /llvm-project/polly/test/ScopDetect/dot-scops.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly '-passes=print<polly-function-scops>,polly-scop-printer' -disable-output < %s
2;
3; Check that the ScopPrinter does not crash.
4; ScopPrinter needs the ScopDetection pass, which should depend on
5; ScalarEvolution transitively.
6;
7; FIXME: -dot-scops always prints to the same hardcoded filename
8;        scops.<functionname>.dot. If there is another test with the same
9;        function name and printing a dot file there will be a race condition
10;        when running tests in parallel.
11
12target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
13
14define void @func(i32 %n, i32 %m, ptr noalias nonnull %A) {
15entry:
16  br label %outer.for
17
18outer.for:
19  %j = phi i32 [0, %entry], [%j.inc, %outer.inc]
20  %j.cmp = icmp slt i32 %j, %n
21  br i1 %j.cmp, label %inner.for, label %outer.exit
22
23  inner.for:
24    %i = phi i32 [1, %outer.for], [%i.inc, %inner.inc]
25    %b = phi double [0.0, %outer.for], [%a, %inner.inc]
26    %i.cmp = icmp slt i32 %i, %m
27    br i1 %i.cmp, label %body1, label %inner.exit
28
29    body1:
30      %A_idx = getelementptr inbounds double, ptr %A, i32 %i
31      %a = load double, ptr %A_idx
32      store double %a, ptr %A_idx
33      br label %inner.inc
34
35  inner.inc:
36    %i.inc = add nuw nsw i32 %i, 1
37    br label %inner.for
38
39  inner.exit:
40    br label %outer.inc
41
42outer.inc:
43  store double %b, ptr %A
44  %j.inc = add nuw nsw i32 %j, 1
45  br label %outer.for
46
47outer.exit:
48  br label %return
49
50return:
51  ret void
52}
53