[llvm] [LV] Update LoopVectorizationPlanner::emitInvalidCostRemarks to handle reduction plans (PR #165913)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 10 03:04:07 PST 2025


================
@@ -0,0 +1,25 @@
+; RUN: opt < %s -passes=loop-vectorize -S -pass-remarks=loop-vectorize -debug-only=loop-vectorize &> %t
+; RUN: cat %t | FileCheck --check-prefix=CHECK-REMARKS %s
+
+; CHECK-REMARKS: LV: Recipe with invalid costs prevented vectorization at VF=(vscale x 1): fadd.
+
+target triple = "aarch64-unknown-linux-gnu"
+
+define double @reduce_fail(i64 %loop_count, double %d0, ptr %ptr1) #0 {
+entry:
+  %d1 = load double, ptr %ptr1
+  br label %loop
+
+loop:
+  %acc0 = phi double [ %fadd0, %loop ], [ %d0, %entry ]
+  %counter = phi i64 [ 0, %entry ], [ %counter_updated, %loop ]
+  %fadd0 = fadd double %acc0, %d1
+  %counter_updated = add nsw nuw i64 %counter, 1
+  %exit_cond = icmp eq i64 %counter_updated, %loop_count
+  br i1 %exit_cond, label %loopexit, label %loop
+
+loopexit:
+  ret double %fadd0
+}
+
+attributes #0 = { "target-features"="+sve" }
----------------
fhahn wrote:

Not sure what the red `-` here means, would be good to just check the test doesn't have any weird line endings.

https://github.com/llvm/llvm-project/pull/165913


More information about the llvm-commits mailing list