1; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s 2 3; This is the test case from PR26314. 4; When we were retrying dependence checking with memchecks only, 5; the loop-invariant access in the inner loop was incorrectly determined to be wrapping 6; because it was not strided in the inner loop. 7 8; #define Z 32 9; typedef struct s { 10; int v1[Z]; 11; int v2[Z]; 12; int v3[Z][Z]; 13; } s; 14; 15; void slow_function (s* const obj, int z) { 16; for (int j=0; j<Z; j++) { 17; for (int k=0; k<z; k++) { 18; int x = obj->v1[k] + obj->v2[j]; 19; obj->v3[j][k] += x; 20; } 21; } 22; } 23 24; CHECK: function 'Test': 25; CHECK: .inner: 26; CHECK-NEXT: Memory dependences are safe with run-time checks 27; CHECK-NEXT: Dependences: 28; CHECK-NEXT: Run-time memory checks: 29; CHECK: Check 0: 30; CHECK: Check 1: 31 32target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 33 34%struct.s = type { [32 x i32], [32 x i32], [32 x [32 x i32]] } 35 36define void @Test(ptr nocapture %obj, i64 %z) #0 { 37 br label %.outer.preheader 38 39 40.outer.preheader: 41 %i = phi i64 [ 0, %0 ], [ %i.next, %.outer ] 42 %1 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 1, i64 %i 43 br label %.inner 44 45.exit: 46 ret void 47 48.outer: 49 %i.next = add nuw nsw i64 %i, 1 50 %exitcond.outer = icmp eq i64 %i.next, 32 51 br i1 %exitcond.outer, label %.exit, label %.outer.preheader 52 53.inner: 54 %j = phi i64 [ 0, %.outer.preheader ], [ %j.next, %.inner ] 55 %2 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 0, i64 %j 56 %3 = load i32, ptr %2 57 %4 = load i32, ptr %1 58 %5 = add nsw i32 %4, %3 59 %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j 60 %7 = load i32, ptr %6 61 %8 = add nsw i32 %5, %7 62 store i32 %8, ptr %6 63 %j.next = add nuw nsw i64 %j, 1 64 %exitcond.inner = icmp eq i64 %j.next, %z 65 br i1 %exitcond.inner, label %.outer, label %.inner 66} 67