[llvm] [LV][VPlan] Implement VPlan-based cost for exit condition. (PR #125640)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 02:03:49 PDT 2025


================
@@ -116,11 +119,12 @@ define i1 @test_extra_cmp_user(ptr nocapture noundef %dst, ptr nocapture noundef
 ; CHECK-LABEL: LV: Checking a loop in 'test_extra_cmp_user'
 ; CHECK: Cost of 4 for VF 8: induction instruction   %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
 ; CHECK-NEXT: Cost of 0 for VF 8: induction instruction   %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
-; CHECK-NEXT: Cost of 4 for VF 8: exit condition instruction   %exitcond.not = icmp eq i64 %indvars.iv.next, 16
 ; CHECK-NEXT: Cost of 0 for VF 8: EMIT vp<{{.+}}> = CANONICAL-INDUCTION ir<0>, vp<%index.next>
-; CHECK: Cost for VF 8: 12
+; CHECK: Cost of 1 for VF 8: EMIT branch-on-count vp<%{{.+}}>, vp<%{{.+}}>
+; CHECK: Cost for VF 8: 13
----------------
david-arm wrote:

Something doesn't look right here. The cost of the exit condition went down from 4->1, yet the total cost of the loop has increased from 12->13. Can you try to find out what's going on here?

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


More information about the llvm-commits mailing list