54 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3; The load access to A has a pointer-bitcast to another elements size before the4; GetElementPtr. Verify that we do not the GEP delinearization because it5; mismatches with the size of the loaded element type.6;7; void f(short A[][4], int N, int P) {8; short(*B)[4] = &A[P][0];9; for (int i = 0; i < N; i++)10; *((<4 x short> *)&A[7 * i][0]) = *((<4 x short>)&B[7 * i][0]);11; }12;13define void @f(ptr %A, i32 %N, i32 %P) {14entry:15 %arrayidx1 = getelementptr inbounds [4 x i16], ptr %A, i32 %P, i64 016 br label %for.cond17 18for.cond:19 %indvars.iv = phi i32 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]20 %cmp = icmp slt i32 %indvars.iv, %N21 br i1 %cmp, label %for.body, label %for.end22 23for.body:24 %mul = mul nsw i32 %indvars.iv, 725 %arrayidx4 = getelementptr inbounds [4 x i16], ptr %arrayidx1, i32 %mul, i64 026 %tmp3 = load <4 x i16>, ptr %arrayidx427 %arrayidx8 = getelementptr inbounds [4 x i16], ptr %A, i32 %mul, i64 028 store <4 x i16> %tmp3, ptr %arrayidx829 br label %for.inc30 31for.inc:32 %indvars.iv.next = add nuw nsw i32 %indvars.iv, 133 br label %for.cond34 35for.end:36 ret void37}38 39 40; CHECK: Arrays {41; CHECK-NEXT: <4 x i16> MemRef_A[*]; // Element size 842; CHECK-NEXT: }43; CHECK: Statements {44; CHECK-NEXT: Stmt_for_body45; CHECK-NEXT: Domain :=46; CHECK-NEXT: [N, P] -> { Stmt_for_body[i0] : 0 <= i0 < N };47; CHECK-NEXT: Schedule :=48; CHECK-NEXT: [N, P] -> { Stmt_for_body[i0] -> [i0] };49; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]50; CHECK-NEXT: [N, P] -> { Stmt_for_body[i0] -> MemRef_A[P + 7i0] };51; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]52; CHECK-NEXT: [N, P] -> { Stmt_for_body[i0] -> MemRef_A[7i0] };53; CHECK-NEXT: }54