[ForwardOpTree] Introduce the -polly-optree pass.
[polly-mirror.git] / test / ForwardOpTree / noforward_sideffects.ll
blob6a688085018f2f19a1134d995038dc6ebbec2ac0
1 ; RUN: opt %loadPolly  -polly-optree -analyze < %s | FileCheck %s -match-full-lines
3 ; Do not forward instructions with side-effects (here: function call).
5 ; for (int j = 0; j < n; j += 1) {
6 ; bodyA:
7 ;   double val = f();
9 ; bodyB:
10 ;   A[0] = val;
11 ; }
13 declare double @f(double* %A) #1
15 define void @func(i32 %n, double* noalias nonnull %A) {
16 entry:
17   br label %for
19 for:
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
24     bodyA:
25       %val = call double (double*) @f(double* %A)
26       br label %bodyB
28     bodyB:
29       store double %val, double* %A
30       br label %inc
32 inc:
33   %j.inc = add nuw nsw i32 %j, 1
34   br label %for
36 exit:
37   br label %return
39 return:
40   ret void
43 attributes #1 = { nounwind readnone }
46 ; CHECK: ForwardOpTree executed, but did not modify anything