xref: /llvm-project/polly/test/CodeGen/MemAccess/default_aligned_new_access_function.ll (revision b332499a94df11870dfc7598645c59656deb933d)
1; RUN: opt %loadPolly -basic-aa -polly-print-import-jscop -disable-output < %s | FileCheck %s
2;
3; Check that we allow the new access functions even though they access
4; different locations than the original ones (but the alignment is the
5; default, thus there is no problem).
6;
7; CHECK-DAG: New access function '{ Stmt_for_body[i0] -> MemRef_B[0] }' detected in JSCOP file
8; CHECK-DAG: New access function '{ Stmt_for_body[i0] -> MemRef_A[i0] }' detected in JSCOP file
9;
10;    void simple_stride(int *restrict A, int *restrict B) {
11;      for (int i = 0; i < 16; i++)
12;        A[i * 2] = B[i * 2];
13;    }
14;
15target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16
17define void @simple_stride(ptr noalias %A, ptr noalias %B) {
18entry:
19  br label %for.cond
20
21for.cond:                                         ; preds = %for.inc, %entry
22  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
23  %exitcond = icmp ne i64 %indvars.iv, 16
24  br i1 %exitcond, label %for.body, label %for.end
25
26for.body:                                         ; preds = %for.cond
27  %tmp = shl nsw i64 %indvars.iv, 1
28  %arrayidx = getelementptr inbounds i32, ptr %B, i64 %tmp
29  %tmp4 = load i32, ptr %arrayidx, align 4
30  %tmp5 = shl nsw i64 %indvars.iv, 1
31  %arrayidx3 = getelementptr inbounds i32, ptr %A, i64 %tmp5
32  store i32 %tmp4, ptr %arrayidx3, align 4
33  br label %for.inc
34
35for.inc:                                          ; preds = %for.body
36  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
37  br label %for.cond
38
39for.end:                                          ; preds = %for.cond
40  ret void
41}
42