|
1 | 1 | ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
|
2 | 2 | ; RUN: opt < %s -passes='function(lower-allow-check)' -S | FileCheck %s --check-prefixes=NOPROFILE
|
3 | 3 | ; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=0 -S | FileCheck %s --check-prefixes=NONE
|
| 4 | +; RUN: opt < %s -passes='function(lower-allow-check)' -lower-allow-check-random-rate=1 -S | FileCheck %s --check-prefixes=ALL |
4 | 5 | ; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=HOT99
|
5 | 6 | ; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-percentile-cutoff-hot=700000 -S | FileCheck %s --check-prefixes=HOT70
|
6 | 7 | ; RUN: opt < %s -passes='require<profile-summary>,function(lower-allow-check)' -lower-allow-check-random-rate=0 -lower-allow-check-percentile-cutoff-hot=990000 -S | FileCheck %s --check-prefixes=NONE99
|
@@ -38,6 +39,19 @@ define dso_local noundef i32 @simple(ptr noundef readonly %0) {
|
38 | 39 | ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
|
39 | 40 | ; NONE-NEXT: ret i32 [[TMP5]]
|
40 | 41 | ;
|
| 42 | +; ALL-LABEL: define dso_local noundef i32 @simple( |
| 43 | +; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) { |
| 44 | +; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null |
| 45 | +; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true |
| 46 | +; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]] |
| 47 | +; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] |
| 48 | +; ALL: 3: |
| 49 | +; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22) |
| 50 | +; ALL-NEXT: unreachable |
| 51 | +; ALL: 4: |
| 52 | +; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4 |
| 53 | +; ALL-NEXT: ret i32 [[TMP5]] |
| 54 | +; |
41 | 55 | ; HOT99-LABEL: define dso_local noundef i32 @simple(
|
42 | 56 | ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) {
|
43 | 57 | ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
|
@@ -133,6 +147,19 @@ define dso_local noundef i32 @hot(ptr noundef readonly %0) !prof !36 {
|
133 | 147 | ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
|
134 | 148 | ; NONE-NEXT: ret i32 [[TMP5]]
|
135 | 149 | ;
|
| 150 | +; ALL-LABEL: define dso_local noundef i32 @hot( |
| 151 | +; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] { |
| 152 | +; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null |
| 153 | +; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true |
| 154 | +; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]] |
| 155 | +; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] |
| 156 | +; ALL: 3: |
| 157 | +; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22) |
| 158 | +; ALL-NEXT: unreachable |
| 159 | +; ALL: 4: |
| 160 | +; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4 |
| 161 | +; ALL-NEXT: ret i32 [[TMP5]] |
| 162 | +; |
136 | 163 | ; HOT99-LABEL: define dso_local noundef i32 @hot(
|
137 | 164 | ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF16:![0-9]+]] {
|
138 | 165 | ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
|
@@ -227,6 +254,19 @@ define dso_local noundef i32 @veryHot(ptr noundef readonly %0) !prof !39 {
|
227 | 254 | ; NONE-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4
|
228 | 255 | ; NONE-NEXT: ret i32 [[TMP5]]
|
229 | 256 | ;
|
| 257 | +; ALL-LABEL: define dso_local noundef i32 @veryHot( |
| 258 | +; ALL-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] { |
| 259 | +; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP0]], null |
| 260 | +; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true |
| 261 | +; ALL-NEXT: [[TMP2:%.*]] = or i1 [[CHK]], [[HOT]] |
| 262 | +; ALL-NEXT: br i1 [[TMP2]], label [[TMP3:%.*]], label [[TMP4:%.*]] |
| 263 | +; ALL: 3: |
| 264 | +; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22) |
| 265 | +; ALL-NEXT: unreachable |
| 266 | +; ALL: 4: |
| 267 | +; ALL-NEXT: [[TMP5:%.*]] = load i32, ptr [[TMP0]], align 4 |
| 268 | +; ALL-NEXT: ret i32 [[TMP5]] |
| 269 | +; |
230 | 270 | ; HOT99-LABEL: define dso_local noundef i32 @veryHot(
|
231 | 271 | ; HOT99-SAME: ptr noundef readonly [[TMP0:%.*]]) !prof [[PROF17:![0-9]+]] {
|
232 | 272 | ; HOT99-NEXT: [[TMP2:%.*]] = icmp eq ptr [[TMP0]], null
|
@@ -334,6 +374,25 @@ define dso_local noundef i32 @branchColdFnHot(i32 noundef %0, ptr noundef readon
|
334 | 374 | ; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
|
335 | 375 | ; NONE-NEXT: ret i32 [[TMP10]]
|
336 | 376 | ;
|
| 377 | +; ALL-LABEL: define dso_local noundef i32 @branchColdFnHot( |
| 378 | +; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] { |
| 379 | +; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 |
| 380 | +; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF18:![0-9]+]] |
| 381 | +; ALL: 4: |
| 382 | +; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null |
| 383 | +; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true |
| 384 | +; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]] |
| 385 | +; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]] |
| 386 | +; ALL: 6: |
| 387 | +; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22) |
| 388 | +; ALL-NEXT: unreachable |
| 389 | +; ALL: 7: |
| 390 | +; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4 |
| 391 | +; ALL-NEXT: br label [[TMP9]] |
| 392 | +; ALL: 9: |
| 393 | +; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ] |
| 394 | +; ALL-NEXT: ret i32 [[TMP10]] |
| 395 | +; |
337 | 396 | ; HOT99-LABEL: define dso_local noundef i32 @branchColdFnHot(
|
338 | 397 | ; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF17]] {
|
339 | 398 | ; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
|
@@ -472,6 +531,25 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
|
472 | 531 | ; NONE-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ]
|
473 | 532 | ; NONE-NEXT: ret i32 [[TMP10]]
|
474 | 533 | ;
|
| 534 | +; ALL-LABEL: define dso_local noundef i32 @branchHotFnCold( |
| 535 | +; ALL-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] { |
| 536 | +; ALL-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0 |
| 537 | +; ALL-NEXT: br i1 [[TMP3]], label [[TMP9:%.*]], label [[TMP4:%.*]], !prof [[PROF19:![0-9]+]] |
| 538 | +; ALL: 4: |
| 539 | +; ALL-NEXT: [[CHK:%.*]] = icmp eq ptr [[TMP1]], null |
| 540 | +; ALL-NEXT: [[HOT:%.*]] = xor i1 true, true |
| 541 | +; ALL-NEXT: [[TMP5:%.*]] = or i1 [[CHK]], [[HOT]] |
| 542 | +; ALL-NEXT: br i1 [[TMP5]], label [[TMP6:%.*]], label [[TMP7:%.*]] |
| 543 | +; ALL: 6: |
| 544 | +; ALL-NEXT: tail call void @llvm.ubsantrap(i8 22) |
| 545 | +; ALL-NEXT: unreachable |
| 546 | +; ALL: 7: |
| 547 | +; ALL-NEXT: [[TMP8:%.*]] = load i32, ptr [[TMP1]], align 4 |
| 548 | +; ALL-NEXT: br label [[TMP9]] |
| 549 | +; ALL: 9: |
| 550 | +; ALL-NEXT: [[TMP10:%.*]] = phi i32 [ [[TMP8]], [[TMP7]] ], [ 0, [[TMP2:%.*]] ] |
| 551 | +; ALL-NEXT: ret i32 [[TMP10]] |
| 552 | +; |
475 | 553 | ; HOT99-LABEL: define dso_local noundef i32 @branchHotFnCold(
|
476 | 554 | ; HOT99-SAME: i32 noundef [[TMP0:%.*]], ptr noundef readonly [[TMP1:%.*]]) !prof [[PROF16]] {
|
477 | 555 | ; HOT99-NEXT: [[TMP3:%.*]] = icmp eq i32 [[TMP0]], 0
|
@@ -606,6 +684,11 @@ define dso_local noundef i32 @branchHotFnCold(i32 noundef %0, ptr noundef readon
|
606 | 684 | ; NONE: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
|
607 | 685 | ; NONE: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000}
|
608 | 686 | ;.
|
| 687 | +; ALL: [[PROF16]] = !{!"function_entry_count", i64 1000} |
| 688 | +; ALL: [[PROF17]] = !{!"function_entry_count", i64 7000} |
| 689 | +; ALL: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1} |
| 690 | +; ALL: [[PROF19]] = !{!"branch_weights", i32 1, i32 1000} |
| 691 | +;. |
609 | 692 | ; HOT99: [[PROF16]] = !{!"function_entry_count", i64 1000}
|
610 | 693 | ; HOT99: [[PROF17]] = !{!"function_entry_count", i64 7000}
|
611 | 694 | ; HOT99: [[PROF18]] = !{!"branch_weights", i32 1000, i32 1}
|
|
0 commit comments