brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · d3e589c Raw
80 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 42; RUN: opt -S -passes='print<access-info>' -pass-remarks-analysis=loop-vectorize -disable-output < %s 2>&1 | FileCheck %s3 4; Test that LoopVectorize don't report 'Use #pragma loop distribute(enable) to allow loop distribution'5; when we already add #pragma clang loop distribute(enable).6;7; Testcase derived from the following C:8;9; #define M  10010; void foo (int *restrict y, int *restrict x, int *restrict indices, int n)11; {12;   int k = 3;13;   #pragma clang loop distribute(enable)14;   for (int i = 0; i < n; i++) {15;     y[i + k * M] = y[i + k* M] + 1;16;     y[i + k * (M+1)] = indices[i] + 2;17;   }18; }19 20define void @foo(ptr noalias nocapture noundef %y, ptr noalias nocapture noundef readnone %x, ptr noalias nocapture noundef readonly %indices, i32 noundef %n) {21; CHECK-LABEL: 'foo'22; CHECK-NEXT:    for.body:23; CHECK-NEXT:      Report: unsafe dependent memory operations in loop.24; CHECK-NEXT:  Backward loop carried data dependence that prevents store-to-load forwarding.25; CHECK-NEXT:      Dependences:26; CHECK-NEXT:        BackwardVectorizableButPreventsForwarding:27; CHECK-NEXT:            %1 = load i32, ptr %arrayidx, align 4 ->28; CHECK-NEXT:            store i32 %add8, ptr %arrayidx12, align 429; CHECK-EMPTY:30; CHECK-NEXT:        BackwardVectorizable:31; CHECK-NEXT:            store i32 %add1, ptr %arrayidx, align 4 ->32; CHECK-NEXT:            store i32 %add8, ptr %arrayidx12, align 433; CHECK-EMPTY:34; CHECK-NEXT:        Forward:35; CHECK-NEXT:            %1 = load i32, ptr %arrayidx, align 4 ->36; CHECK-NEXT:            store i32 %add1, ptr %arrayidx, align 437; CHECK-EMPTY:38; CHECK-NEXT:      Run-time memory checks:39; CHECK-NEXT:      Grouped accesses:40; CHECK-EMPTY:41; CHECK-NEXT:      Non vectorizable stores to invariant address were not found in loop.42; CHECK-NEXT:      SCEV assumptions:43; CHECK-EMPTY:44; CHECK-NEXT:      Expressions re-written:45;46entry:47  %cmp22 = icmp sgt i32 %n, 048  br i1 %cmp22, label %for.body.preheader, label %for.cond.cleanup49 50for.body.preheader:                               ; preds = %entry51  %wide.trip.count = zext i32 %n to i6452  br label %for.body53 54for.cond.cleanup.loopexit:                        ; preds = %for.body55  br label %for.cond.cleanup56 57for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry58  ret void59 60for.body:                                         ; preds = %for.body, %for.body.preheader61  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, %for.body ]62  %0 = add nuw nsw i64 %indvars.iv, 30063  %arrayidx = getelementptr inbounds i32, ptr %y, i64 %064  %1 = load i32, ptr %arrayidx, align 465  %add1 = add nsw i32 %1, 166  store i32 %add1, ptr %arrayidx, align 467  %arrayidx7 = getelementptr inbounds i32, ptr %indices, i64 %indvars.iv68  %2 = load i32, ptr %arrayidx7, align 469  %add8 = add nsw i32 %2, 270  %3 = add nuw nsw i64 %indvars.iv, 30371  %arrayidx12 = getelementptr inbounds i32, ptr %y, i64 %372  store i32 %add8, ptr %arrayidx12, align 473  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 174  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count75  br i1 %exitcond.not, label %for.cond.cleanup.loopexit, label %for.body, !llvm.loop !076}77 78!0 = distinct !{!0, !1}79!1 = !{!"llvm.loop.distribute.enable", i1 true}80