Skip to content

Commit efda519

Browse files
authored
[LV] Use branch_weights metadata in getPredBlockCostDivisor test. NFC (llvm#171299)
This is more reliable in the event that the trivial fcmp gets folded away.
1 parent d18cdc9 commit efda519

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/predicated-costs.ll

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,19 @@ exit:
442442
; low, so the discount in getPredBlockCostDivisor is high enough to not fit in
443443
; uint32_t. Make sure we return uint64_t which fits all possible BlockFrequency
444444
; values.
445-
define void @getPredBlockCostDivisor_truncate(i32 %0) {
445+
define void @getPredBlockCostDivisor_truncate(i32 %0, i1 %c1, i1 %c2, ptr %p) {
446446
; CHECK-LABEL: define void @getPredBlockCostDivisor_truncate(
447-
; CHECK-SAME: i32 [[TMP0:%.*]]) {
447+
; CHECK-SAME: i32 [[TMP0:%.*]], i1 [[C1:%.*]], i1 [[C2:%.*]], ptr [[P:%.*]]) {
448448
; CHECK-NEXT: [[ENTRY:.*]]:
449449
; CHECK-NEXT: br label %[[LOOP:.*]]
450450
; CHECK: [[LOOP]]:
451451
; CHECK-NEXT: [[IV:%.*]] = phi i32 [ [[TMP0]], %[[ENTRY]] ], [ [[IV_NEXT:%.*]], %[[LATCH:.*]] ]
452-
; CHECK-NEXT: [[ISNAN_1:%.*]] = fcmp uno double 0.000000e+00, 0.000000e+00
453-
; CHECK-NEXT: br i1 [[ISNAN_1]], label %[[IF_1:.*]], label %[[LATCH]]
452+
; CHECK-NEXT: br i1 [[C1]], label %[[IF_1:.*]], label %[[LATCH]], !prof [[PROF15:![0-9]+]]
454453
; CHECK: [[IF_1]]:
455-
; CHECK-NEXT: [[ISNAN_2:%.*]] = fcmp uno double 0.000000e+00, 0.000000e+00
456-
; CHECK-NEXT: br i1 [[ISNAN_2]], label %[[IF_2:.*]], label %[[LATCH]]
454+
; CHECK-NEXT: br i1 [[C2]], label %[[IF_2:.*]], label %[[LATCH]], !prof [[PROF15]]
457455
; CHECK: [[IF_2]]:
456+
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[P]], i32 [[IV]]
457+
; CHECK-NEXT: store i32 0, ptr [[GEP]], align 4
458458
; CHECK-NEXT: br label %[[LATCH]]
459459
; CHECK: [[LATCH]]:
460460
; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], 1
@@ -468,14 +468,14 @@ entry:
468468

469469
loop:
470470
%iv = phi i32 [ %0, %entry ], [ %iv.next, %latch ]
471-
%isnan.1 = fcmp uno double 0.000000e+00, 0.000000e+00
472-
br i1 %isnan.1, label %if.1, label %latch
471+
br i1 %c1, label %if.1, label %latch, !prof !4
473472

474473
if.1:
475-
%isnan.2 = fcmp uno double 0.000000e+00, 0.000000e+00
476-
br i1 %isnan.2, label %if.2, label %latch
474+
br i1 %c2, label %if.2, label %latch, !prof !4
477475

478476
if.2:
477+
%gep = getelementptr i32, ptr %p, i32 %iv
478+
store i32 0, ptr %gep
479479
br label %latch
480480

481481
latch:
@@ -487,6 +487,8 @@ exit:
487487
ret void
488488
}
489489

490+
!4 = !{!"branch_weights", i32 0, i32 1}
491+
490492
;.
491493
; CHECK: [[META0]] = !{[[META1:![0-9]+]]}
492494
; CHECK: [[META1]] = distinct !{[[META1]], [[META2:![0-9]+]]}
@@ -503,4 +505,5 @@ exit:
503505
; CHECK: [[LOOP12]] = distinct !{[[LOOP12]], [[META9]], [[META10]]}
504506
; CHECK: [[LOOP13]] = distinct !{[[LOOP13]], [[META10]], [[META11]]}
505507
; CHECK: [[LOOP14]] = distinct !{[[LOOP14]], [[META11]], [[META10]]}
508+
; CHECK: [[PROF15]] = !{!"branch_weights", i32 0, i32 1}
506509
;.

0 commit comments

Comments
 (0)