[Clang][Concepts] Fix the constraint equivalence checking involving parameter packs...
[llvm-project.git] / polly / test / ScopDetect / non-affine-loop.ll
blob5136b3b8779b1dfe8a59a0c19f0c18366f952fae
1 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false                                                          '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
2 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true                                                           '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
3 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -polly-allow-nonaffine                                   '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES
4 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true  -polly-allow-nonaffine                                   '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
5 ; RUN: opt %loadNPMPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true  -polly-allow-nonaffine -polly-process-unprofitable=false '-passes=print<polly-detect>' -disable-output < %s 2>&1 | FileCheck %s --check-prefix=PROFIT
7 ; This function/region does contain a loop, however it is non-affine, hence the access
8 ; A[i] is also. Furthermore, it is the only loop, thus when we over approximate
9 ; non-affine loops __and__ accesses __and__ allow regions without a (affine) loop we will
10 ; detect it, otherwise we won't.
12 ;    void f(int *A) {
13 ;      for (int i = 0; i < A[i]; i++)
14 ;        A[-1]++;
15 ;    }
17 ; REJECTNONAFFINELOOPS-NOT:              Valid
18 ; ALLOWNONAFFINELOOPS-NOT:               Valid
19 ; ALLOWNONAFFINEREGIONSANDACCESSES-NOT:  Valid
20 ; ALLOWNONAFFINELOOPSANDACCESSES:        Valid
21 ; PROFIT-NOT:                            Valid
23 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
25 define void @f(ptr %A) {
26 bb:
27   br label %bb1
29 bb1:                                              ; preds = %bb9, %bb
30   %indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ]
31   %tmp = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
32   %tmp2 = load i32, ptr %tmp, align 4
33   %tmp3 = sext i32 %tmp2 to i64
34   %tmp4 = icmp slt i64 %indvars.iv, %tmp3
35   br i1 %tmp4, label %bb5, label %bb10
37 bb5:                                              ; preds = %bb1
38   %tmp6 = getelementptr inbounds i32, ptr %A, i64 -1
39   %tmp7 = load i32, ptr %tmp6, align 4
40   %tmp8 = add nsw i32 %tmp7, 1
41   store i32 %tmp8, ptr %tmp6, align 4
42   br label %bb9
44 bb9:                                              ; preds = %bb5
45   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
46   br label %bb1
48 bb10:                                             ; preds = %bb1
49   ret void