llvm-project/polly/test/ScopDetect/non-affine-loop.ll
Gabriel Ravier ea540bc210
[polly] Fixed a number of typos. NFC
I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: inclyc

Differential Revision: https://reviews.llvm.org/D131167
2022-08-07 22:56:07 +08:00

51 lines
2.7 KiB
LLVM

; RUN: opt %loadPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -polly-print-detect -disable-output < %s | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS
; RUN: opt %loadPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-print-detect -disable-output < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS
; RUN: opt %loadPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=false -polly-allow-nonaffine -polly-print-detect -disable-output < %s | FileCheck %s --check-prefix=ALLOWNONAFFINEREGIONSANDACCESSES
; RUN: opt %loadPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine -polly-print-detect -disable-output < %s | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPSANDACCESSES
; RUN: opt %loadPolly -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true -polly-allow-nonaffine -polly-process-unprofitable=false -polly-print-detect -disable-output < %s | FileCheck %s --check-prefix=PROFIT
;
; This function/region does contain a loop, however it is non-affine, hence the access
; A[i] is also. Furthermore, it is the only loop, thus when we over approximate
; non-affine loops __and__ accesses __and__ allow regions without a (affine) loop we will
; detect it, otherwise we won't.
;
; void f(int *A) {
; for (int i = 0; i < A[i]; i++)
; A[-1]++;
; }
;
; REJECTNONAFFINELOOPS-NOT: Valid
; ALLOWNONAFFINELOOPS-NOT: Valid
; ALLOWNONAFFINEREGIONSANDACCESSES-NOT: Valid
; ALLOWNONAFFINELOOPSANDACCESSES: Valid
; PROFIT-NOT: Valid
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @f(i32* %A) {
bb:
br label %bb1
bb1: ; preds = %bb9, %bb
%indvars.iv = phi i64 [ %indvars.iv.next, %bb9 ], [ 0, %bb ]
%tmp = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
%tmp2 = load i32, i32* %tmp, align 4
%tmp3 = sext i32 %tmp2 to i64
%tmp4 = icmp slt i64 %indvars.iv, %tmp3
br i1 %tmp4, label %bb5, label %bb10
bb5: ; preds = %bb1
%tmp6 = getelementptr inbounds i32, i32* %A, i64 -1
%tmp7 = load i32, i32* %tmp6, align 4
%tmp8 = add nsw i32 %tmp7, 1
store i32 %tmp8, i32* %tmp6, align 4
br label %bb9
bb9: ; preds = %bb5
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %bb1
bb10: ; preds = %bb1
ret void
}