brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 7819ae2 Raw
35 lines · plain
1; REQUIRES: asserts2; RUN: opt < %s -passes=loop-vectorize -mtriple riscv64 -mattr="+v" -debug-only=loop-vectorize --disable-output -S 2>&1 | FileCheck %s3 4; CHECK: LV: Loop hints: force=enabled5; CHECK: LV: Scalar loop costs: 4.6; ChosenFactor.Cost is 9, but the real cost will be divided by the width, which is 2.2.7; CHECK: Cost for VF vscale x 2: 98; Regardless of force vectorization or not, this loop will eventually be vectorized because of the cost model.9; Therefore, the following message does not need to be printed even if vectorization is explicitly forced in the metadata.10; CHECK-NOT: LV: Vectorization seems to be not beneficial, but was forced by a user.11 12target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"13target triple = "riscv64-unknown-unknown"14 15define i64 @foo(ptr nocapture noundef readonly %a, i64 noundef %N, i64 noundef %init) {16entry:17  br label %for.body18 19for.body:                                         ; preds = %entry, %for.body20  %i.06 = phi i64 [ %inc, %for.body ], [ 0, %entry ]21  %rd.05 = phi i64 [ %add, %for.body ], [ %init, %entry ]22  %arrayidx = getelementptr inbounds i64, ptr %a, i64 %i.0623  %0 = load i64, ptr %arrayidx, align 824  %add = add nsw i64 %0, %rd.0525  %inc = add nuw i64 %i.06, 126  %exitcond.not = icmp eq i64 %inc, %N27  br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !028 29for.end:                                          ; preds = %for.body30  ret i64 %add31}32 33!0 = !{!0, !1}34!1 = !{!"llvm.loop.vectorize.enable", i1 true}35