[llvm] [LV] Use branch_weights metadata in getPredBlockCostDivisor test. NFC (PR #171299)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 00:45:55 PST 2025


https://github.com/lukel97 created https://github.com/llvm/llvm-project/pull/171299

This is more reliable in the event that the trivial fcmp gets folded away.


>From 0565ab8de914071ec1511bfe8797c41f7a012e13 Mon Sep 17 00:00:00 2001
From: Luke Lau <luke at igalia.com>
Date: Tue, 9 Dec 2025 16:44:13 +0800
Subject: [PATCH] [LV] Use branch_weights metadata in getPredBlockCostDivisor
 test. NFC

This is more reliable in the event that the trivial fcmp gets folded away.
---
 .../LoopVectorize/AArch64/predicated-costs.ll          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll
index 7787e927d24ff..153ee2377955d 100644
--- a/llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll
+++ b/llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll
@@ -442,7 +442,7 @@ exit:
 ; low, so the discount in getPredBlockCostDivisor is high enough to not fit in
 ; uint32_t. Make sure we return uint64_t which fits all possible BlockFrequency
 ; values.
-define void @getPredBlockCostDivisor_truncate(i32 %0) {
+define void @getPredBlockCostDivisor_truncate(i32 %0, i1 %c1, i1 %c2) {
 ; CHECK-LABEL: define void @getPredBlockCostDivisor_truncate(
 ; CHECK-SAME: i32 [[TMP0:%.*]]) {
 ; CHECK-NEXT:  [[ENTRY:.*]]:
@@ -468,12 +468,10 @@ entry:
 
 loop:
   %iv = phi i32 [ %0, %entry ], [ %iv.next, %latch ]
-  %isnan.1 = fcmp uno double 0.000000e+00, 0.000000e+00
-  br i1 %isnan.1, label %if.1, label %latch
+  br i1 %c1, label %if.1, label %latch, !prof !4
 
 if.1:
-  %isnan.2 = fcmp uno double 0.000000e+00, 0.000000e+00
-  br i1 %isnan.2, label %if.2, label %latch
+  br i1 %c2, label %if.2, label %latch, !prof !4
 
 if.2:
   br label %latch
@@ -487,6 +485,8 @@ exit:
   ret void
 }
 
+!4 = !{!"branch_weights", i32 0, i32 1}
+
 ;.
 ; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
 ; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]]}



More information about the llvm-commits mailing list