53 lines · plain
1; RUN: opt %loadNPMPolly -S '-passes=polly<no-default-opts>' < %s | FileCheck %s2;3; We should only access (or compute the address of) "the first element" of %S4; as it is a single struct not a struct array. The maximal access to S, thus5; S->B[1023] is for ScalarEvolution an access with offset of 1423, 1023 for the6; index inside the B part of S and 400 to skip the Dummy array in S. Note that7; these numbers are relative to the actual type of &S->B[i] (char*) not to the8; type of S (struct st *) or something else.9;10; Verify that we do not use the offset 1423 into a non existent S array when we11; compute runtime alias checks but treat it as if it was a char array.12;13; CHECK: %polly.access.S = getelementptr i8, ptr %S, i64 142414;15; struct st {16; int Dummy[100];17; char B[100];18; };19;20; void jd(int *A, struct st *S) {21; for (int i = 0; i < 1024; i++)22; A[i] = S->B[i];23; }24;25target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"26 27%struct.st = type { [100 x i32], [100 x i8] }28 29define void @jd(ptr %A, ptr %S) {30entry:31 br label %for.cond32 33for.cond: ; preds = %for.inc, %entry34 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]35 %exitcond = icmp ne i64 %indvars.iv, 102436 br i1 %exitcond, label %for.body, label %for.end37 38for.body: ; preds = %for.cond39 %arrayidx = getelementptr inbounds %struct.st, ptr %S, i64 0, i32 1, i64 %indvars.iv40 %tmp = load i8, ptr %arrayidx, align 141 %conv = sext i8 %tmp to i3242 %arrayidx2 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv43 store i32 %conv, ptr %arrayidx2, align 444 br label %for.inc45 46for.inc: ; preds = %for.body47 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 148 br label %for.cond49 50for.end: ; preds = %for.cond51 ret void52}53