101 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 52; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s3 4; This is the test case from PR26314.5; When we were retrying dependence checking with memchecks only,6; the loop-invariant access in the inner loop was incorrectly determined to be wrapping7; because it was not strided in the inner loop.8 9; #define Z 3210; typedef struct s {11; int v1[Z];12; int v2[Z];13; int v3[Z][Z];14; } s;15;16; void slow_function (s* const obj, int z) {17; for (int j=0; j<Z; j++) {18; for (int k=0; k<z; k++) {19; int x = obj->v1[k] + obj->v2[j];20; obj->v3[j][k] += x;21; }22; }23; }24 25target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"26 27%struct.s = type { [32 x i32], [32 x i32], [32 x [32 x i32]] }28 29define void @Test(ptr nocapture %obj, i64 %z) #0 {30; CHECK-LABEL: 'Test'31; CHECK-NEXT: .inner:32; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 2048 bits with run-time checks33; CHECK-NEXT: Dependences:34; CHECK-NEXT: Run-time memory checks:35; CHECK-NEXT: Check 0:36; CHECK-NEXT: Comparing group GRP0:37; CHECK-NEXT: %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j38; CHECK-NEXT: Against group GRP1:39; CHECK-NEXT: %2 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 0, i64 %j40; CHECK-NEXT: Check 1:41; CHECK-NEXT: Comparing group GRP0:42; CHECK-NEXT: %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j43; CHECK-NEXT: Against group GRP2:44; CHECK-NEXT: %1 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 1, i64 %i45; CHECK-NEXT: Grouped accesses:46; CHECK-NEXT: Group GRP0:47; CHECK-NEXT: (Low: {(256 + %obj)<nuw>,+,128}<nuw><%.outer.preheader> High: {(256 + (4 * %z) + %obj),+,128}<nw><%.outer.preheader>)48; CHECK-NEXT: Member: {{\{\{}}(256 + %obj)<nuw>,+,128}<nuw><%.outer.preheader>,+,4}<nuw><%.inner>49; CHECK-NEXT: Group GRP1:50; CHECK-NEXT: (Low: %obj High: ((4 * %z) + %obj))51; CHECK-NEXT: Member: {%obj,+,4}<nuw><%.inner>52; CHECK-NEXT: Group GRP2:53; CHECK-NEXT: (Low: {(128 + %obj)<nuw>,+,4}<nuw><%.outer.preheader> High: {(132 + %obj),+,4}<nw><%.outer.preheader>)54; CHECK-NEXT: Member: {(128 + %obj)<nuw>,+,4}<nuw><%.outer.preheader>55; CHECK-EMPTY:56; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.57; CHECK-NEXT: SCEV assumptions:58; CHECK-EMPTY:59; CHECK-NEXT: Expressions re-written:60; CHECK-NEXT: .outer.preheader:61; CHECK-NEXT: Report: loop is not the innermost loop62; CHECK-NEXT: Dependences:63; CHECK-NEXT: Run-time memory checks:64; CHECK-NEXT: Grouped accesses:65; CHECK-EMPTY:66; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.67; CHECK-NEXT: SCEV assumptions:68; CHECK-EMPTY:69; CHECK-NEXT: Expressions re-written:70;71 br label %.outer.preheader72 73 74.outer.preheader:75 %i = phi i64 [ 0, %0 ], [ %i.next, %.outer ]76 %1 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 1, i64 %i77 br label %.inner78 79.exit:80 ret void81 82.outer:83 %i.next = add nuw nsw i64 %i, 184 %exitcond.outer = icmp eq i64 %i.next, 3285 br i1 %exitcond.outer, label %.exit, label %.outer.preheader86 87.inner:88 %j = phi i64 [ 0, %.outer.preheader ], [ %j.next, %.inner ]89 %2 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 0, i64 %j90 %3 = load i32, ptr %291 %4 = load i32, ptr %192 %5 = add nsw i32 %4, %393 %6 = getelementptr inbounds %struct.s, ptr %obj, i64 0, i32 2, i64 %i, i64 %j94 %7 = load i32, ptr %695 %8 = add nsw i32 %5, %796 store i32 %8, ptr %697 %j.next = add nuw nsw i64 %j, 198 %exitcond.inner = icmp eq i64 %j.next, %z99 br i1 %exitcond.inner, label %.outer, label %.inner100}101