96 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 52; RUN: opt < %s -passes='print<delinearization>' -disable-output 2>&1 | FileCheck %s3 4; #define MR(mt,n,r,c,d) mt->m[(n) * mt->mrows * mt->mcols * mt->mdeps + (r) * mt->mcols* mt->mdeps + (c) * mt->mdeps + (d)]5;6; struct Mat {7; float* m;8; int mnums;9; int mrows;10; int mcols;11; int mdeps;12; };13;14; typedef struct Mat Matrix;15;16; void jacobi(int nn, Matrix* a, Matrix* p)17; {18; long i, j, k, max,jmax,kmax;19;20; p_rows_sub = p->mrows - 1;21; p_cols_sub = p->mcols - 1;22; p_deps_sub = p->mdeps - 1;23;24; for(i = 1; i < p_rows_sub; i++)25; for(j = 1; j < p_cols_sub; j++)26; for(k = 1; k < p_deps_sub; k++)27; MR(a,0,i,j,k) = i + j + k;28; }29 30%struct.Mat = type { ptr, i32, i32, i32, i32 }31 32define void @jacobi(i32 %nn, ptr nocapture %a, ptr nocapture %p) nounwind uwtable {33; CHECK-LABEL: 'jacobi'34; CHECK-NEXT: Inst: store float 1.000000e+00, ptr %arrayidx, align 435; CHECK-NEXT: AccessFunction: {{\{\{\{}}(4 + (4 * (sext i32 %a.deps to i64) * (1 + (sext i32 %a.cols to i64))<nsw>)),+,(4 * (sext i32 %a.deps to i64) * (sext i32 %a.cols to i64))}<%for.i>,+,(4 * (sext i32 %a.deps to i64))<nsw>}<%for.j>,+,4}<%for.k>36; CHECK-NEXT: Base offset: %a.base37; CHECK-NEXT: ArrayDecl[UnknownSize][(sext i32 %a.cols to i64)][(sext i32 %a.deps to i64)] with elements of 4 bytes.38; CHECK-NEXT: ArrayRef[{1,+,1}<nuw><nsw><%for.i>][{1,+,1}<nuw><nsw><%for.j>][{1,+,1}<nuw><nsw><%for.k>]39; CHECK-NEXT: Delinearization validation: Failed40;41entry:42 %p.rows.ptr = getelementptr inbounds %struct.Mat, ptr %p, i64 0, i32 243 %p.rows = load i32, ptr %p.rows.ptr44 %p.rows.sub = add i32 %p.rows, -145 %p.rows.sext = sext i32 %p.rows.sub to i6446 %p.cols.ptr = getelementptr inbounds %struct.Mat, ptr %p, i64 0, i32 347 %p.cols = load i32, ptr %p.cols.ptr48 %p.cols.sub = add i32 %p.cols, -149 %p.cols.sext = sext i32 %p.cols.sub to i6450 %p.deps.ptr = getelementptr inbounds %struct.Mat, ptr %p, i64 0, i32 451 %p.deps = load i32, ptr %p.deps.ptr52 %p.deps.sub = add i32 %p.deps, -153 %p.deps.sext = sext i32 %p.deps.sub to i6454 %a.cols.ptr = getelementptr inbounds %struct.Mat, ptr %a, i64 0, i32 355 %a.cols = load i32, ptr %a.cols.ptr56 %a.deps.ptr = getelementptr inbounds %struct.Mat, ptr %a, i64 0, i32 457 %a.deps = load i32, ptr %a.deps.ptr58 %a.base = load ptr, ptr %a, align 859 br label %for.i60 61for.i: ; preds = %for.i.inc, %entry62 %i = phi i64 [ %i.inc, %for.i.inc ], [ 1, %entry ]63 br label %for.j64 65for.j: ; preds = %for.j.inc, %for.i66 %j = phi i64 [ %j.inc, %for.j.inc ], [ 1, %for.i ]67 %a.cols.sext = sext i32 %a.cols to i6468 %a.deps.sext = sext i32 %a.deps to i6469 br label %for.k70 71for.k: ; preds = %for.k, %for.j72 %k = phi i64 [ 1, %for.j ], [ %k.inc, %for.k ]73 %tmp1 = mul nsw i64 %a.cols.sext, %i74 %tmp2 = add i64 %tmp1, %j75 %tmp3 = mul i64 %tmp2, %a.deps.sext76 %tmp4 = add nsw i64 %k, %tmp377 %arrayidx = getelementptr inbounds float, ptr %a.base, i64 %tmp478 store float 1.000000e+00, ptr %arrayidx79 %k.inc = add nsw i64 %k, 180 %k.exitcond = icmp eq i64 %k.inc, %p.deps.sext81 br i1 %k.exitcond, label %for.j.inc, label %for.k82 83for.j.inc: ; preds = %for.k84 %j.inc = add nsw i64 %j, 185 %j.exitcond = icmp eq i64 %j.inc, %p.cols.sext86 br i1 %j.exitcond, label %for.i.inc, label %for.j87 88for.i.inc: ; preds = %for.j.inc89 %i.inc = add nsw i64 %i, 190 %i.exitcond = icmp eq i64 %i.inc, %p.rows.sext91 br i1 %i.exitcond, label %end, label %for.i92 93end: ; preds = %for.i.inc94 ret void95}96