153 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>" %s 2>&1 | FileCheck %s3 4@a = dso_local local_unnamed_addr global [65536 x float] zeroinitializer, align 165 6; Generated from the following C code:7; #define LEN 256 * 2568; float a[LEN];9;10; void different_strides() {11; for (int i = 0; i < LEN - 1024 - 255; i++) {12; #pragma clang loop interleave(disable)13; #pragma clang loop unroll(disable)14; for (int j = 0; j < 256; j++)15; a[i + j + 1024] += a[j * 4 + i];16; }17; }18; The load and store have different strides(4 and 16 bytes respectively) but the store19; is always at safe positive distance away from the load, thus BackwardVectorizable20define void @different_strides_backward_vectorizable() {21; CHECK-LABEL: 'different_strides_backward_vectorizable'22; CHECK-NEXT: inner.body:23; CHECK-NEXT: Memory dependences are safe24; CHECK-NEXT: Dependences:25; CHECK-NEXT: Forward:26; CHECK-NEXT: %5 = load float, ptr %arrayidx8, align 4 ->27; CHECK-NEXT: store float %add9, ptr %arrayidx8, align 428; CHECK-EMPTY:29; CHECK-NEXT: Run-time memory checks:30; CHECK-NEXT: Grouped accesses:31; CHECK-EMPTY:32; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.33; CHECK-NEXT: SCEV assumptions:34; CHECK-EMPTY:35; CHECK-NEXT: Expressions re-written:36; CHECK-NEXT: outer.header:37; CHECK-NEXT: Report: loop is not the innermost loop38; CHECK-NEXT: Dependences:39; CHECK-NEXT: Run-time memory checks:40; CHECK-NEXT: Grouped accesses:41; CHECK-EMPTY:42; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.43; CHECK-NEXT: SCEV assumptions:44; CHECK-EMPTY:45; CHECK-NEXT: Expressions re-written:46;47entry:48 br label %outer.header49 50outer.header:51 %i = phi i64 [ 0, %entry ], [ %i.next, %outer.latch ]52 %0 = add nuw nsw i64 %i, 102453 br label %inner.body54 55inner.body:56 %j = phi i64 [ 0, %outer.header ], [ %j.next, %inner.body ]57 %1 = shl nuw nsw i64 %j, 258 %2 = add nuw nsw i64 %1, %i59 %arrayidx = getelementptr inbounds [65536 x float], ptr @a, i64 0, i64 %260 %3 = load float, ptr %arrayidx, align 461 %4 = add nuw nsw i64 %0, %j62 %arrayidx8 = getelementptr inbounds [65536 x float], ptr @a, i64 0, i64 %463 %5 = load float, ptr %arrayidx8, align 464 %add9 = fadd fast float %5, %365 store float %add9, ptr %arrayidx8, align 466 %j.next = add nuw nsw i64 %j, 167 %exitcond.not = icmp eq i64 %j.next, 25668 br i1 %exitcond.not, label %outer.latch, label %inner.body69 70outer.latch:71 %i.next = add nuw nsw i64 %i, 172 %outerexitcond.not = icmp eq i64 %i.next, 6425773 br i1 %outerexitcond.not, label %exit, label %outer.header74 75exit:76 ret void77}78 79 80; Generated from following C code:81; void different_stride_and_not_vectorizable(){82; for(int i = 0; i < LEN2; i++){83; for(int j = 0 ; j < LEN; j++){84; a[i + j + LEN] += a[i + 4*j];85; }86; }87; }88; The load and store have different strides, but the store and load are not at a89; safe distance away from each other, thus not safe for vectorization.90define void @different_stride_and_not_vectorizable() {91; CHECK-LABEL: 'different_stride_and_not_vectorizable'92; CHECK-NEXT: inner.body:93; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop94; CHECK-NEXT: Unknown data dependence.95; CHECK-NEXT: Dependences:96; CHECK-NEXT: Unknown:97; CHECK-NEXT: %3 = load float, ptr %arrayidx, align 4 ->98; CHECK-NEXT: store float %add9, ptr %arrayidx8, align 499; CHECK-EMPTY:100; CHECK-NEXT: Forward:101; CHECK-NEXT: %5 = load float, ptr %arrayidx8, align 4 ->102; CHECK-NEXT: store float %add9, ptr %arrayidx8, align 4103; CHECK-EMPTY:104; CHECK-NEXT: Run-time memory checks:105; CHECK-NEXT: Grouped accesses:106; CHECK-EMPTY:107; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.108; CHECK-NEXT: SCEV assumptions:109; CHECK-EMPTY:110; CHECK-NEXT: Expressions re-written:111; CHECK-NEXT: outer.header:112; CHECK-NEXT: Report: loop is not the innermost loop113; CHECK-NEXT: Dependences:114; CHECK-NEXT: Run-time memory checks:115; CHECK-NEXT: Grouped accesses:116; CHECK-EMPTY:117; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.118; CHECK-NEXT: SCEV assumptions:119; CHECK-EMPTY:120; CHECK-NEXT: Expressions re-written:121;122entry:123 br label %outer.header124 125outer.header:126 %i = phi i64 [ 0, %entry ], [ %i.next, %outer.latch ]127 %0 = add nuw nsw i64 %i, 256128 br label %inner.body129 130inner.body:131 %j = phi i64 [ 0, %outer.header ], [ %j.next, %inner.body ]132 %1 = shl nuw nsw i64 %j, 2133 %2 = add nuw nsw i64 %1, %i134 %arrayidx = getelementptr inbounds [65536 x float], ptr @a, i64 0, i64 %2135 %3 = load float, ptr %arrayidx, align 4136 %4 = add nuw nsw i64 %0, %j137 %arrayidx8 = getelementptr inbounds [65536 x float], ptr @a, i64 0, i64 %4138 %5 = load float, ptr %arrayidx8, align 4139 %add9 = fadd fast float %5, %3140 store float %add9, ptr %arrayidx8, align 4141 %j.next = add nuw nsw i64 %j, 1142 %exitcond.not = icmp eq i64 %j.next, 256143 br i1 %exitcond.not, label %outer.latch, label %inner.body144 145outer.latch:146 %i.next = add nuw nsw i64 %i, 1147 %exitcond29.not = icmp eq i64 %i.next, 65536148 br i1 %exitcond29.not, label %exit, label %outer.header149 150exit:151 ret void152}153