xref: /llvm-project/polly/test/ForwardOpTree/noforward_sideffects.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly  '-passes=print<polly-optree>' -disable-output < %s | FileCheck %s -match-full-lines
2;
3; Do not forward instructions with side-effects (here: function call).
4;
5; for (int j = 0; j < n; j += 1) {
6; bodyA:
7;   double val = f();
8;
9; bodyB:
10;   A[0] = val;
11; }
12;
13declare double @f(ptr %A) #1
14
15define void @func(i32 %n, ptr noalias nonnull %A) {
16entry:
17  br label %for
18
19for:
20  %j = phi i32 [0, %entry], [%j.inc, %inc]
21  %j.cmp = icmp slt i32 %j, %n
22  br i1 %j.cmp, label %bodyA, label %exit
23
24    bodyA:
25      %val = call double (ptr) @f(ptr %A)
26      br label %bodyB
27
28    bodyB:
29      store double %val, ptr %A
30      br label %inc
31
32inc:
33  %j.inc = add nuw nsw i32 %j, 1
34  br label %for
35
36exit:
37  br label %return
38
39return:
40  ret void
41}
42
43attributes #1 = { nounwind readnone }
44
45
46; CHECK: ForwardOpTree executed, but did not modify anything
47