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

via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 00:46:30 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Luke Lau (lukel97)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/171299.diff


1 Files Affected:

- (modified) llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll (+5-5) 


``````````diff
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]+]]}

``````````

</details>


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


More information about the llvm-commits mailing list