-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[profcheck] Option to inject distinct small weights #159644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mtrofin
merged 1 commit into
main
from
users/mtrofin/09-18-_profcheck_option_to_inject_distinct_small_weights
Sep 24, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 6 | ||
; RUN: opt -passes=prof-inject -profcheck-weights-for-test %s -S -o - | FileCheck %s --check-prefixes=TEST,CHECK | ||
; RUN: opt -passes=prof-inject %s -S -o - | FileCheck %s --check-prefixes=NORMAL,CHECK | ||
|
||
define void @foo(i32 %cond) { | ||
; TEST-LABEL: define void @foo( | ||
; TEST-SAME: i32 [[COND:%.*]]) !prof [[PROF0:![0-9]+]] { | ||
; TEST-NEXT: [[I:%.*]] = icmp eq i32 [[COND]], 0 | ||
; TEST-NEXT: br i1 [[I]], label %[[A:.*]], label %[[B:.*]], !prof [[PROF1:![0-9]+]] | ||
; TEST: [[A]]: | ||
; TEST-NEXT: switch i32 [[COND]], label %[[DEFAULT:.*]] [ | ||
; TEST-NEXT: i32 10, label %[[C:.*]] | ||
; TEST-NEXT: i32 20, label %[[D:.*]] | ||
; TEST-NEXT: ], !prof [[PROF2:![0-9]+]] | ||
; TEST: [[BB1:.*:]] | ||
; TEST-NEXT: br label %[[B]] | ||
; TEST: [[B]]: | ||
; TEST-NEXT: ret void | ||
; TEST: [[DEFAULT]]: | ||
; TEST-NEXT: ret void | ||
; TEST: [[C]]: | ||
; TEST-NEXT: ret void | ||
; TEST: [[D]]: | ||
; TEST-NEXT: ret void | ||
; | ||
; NORMAL-LABEL: define void @foo( | ||
; NORMAL-SAME: i32 [[COND:%.*]]) !prof [[PROF0:![0-9]+]] { | ||
; NORMAL-NEXT: [[I:%.*]] = icmp eq i32 [[COND]], 0 | ||
; NORMAL-NEXT: br i1 [[I]], label %[[A:.*]], label %[[B:.*]], !prof [[PROF1:![0-9]+]] | ||
; NORMAL: [[A]]: | ||
; NORMAL-NEXT: switch i32 [[COND]], label %[[DEFAULT:.*]] [ | ||
; NORMAL-NEXT: i32 10, label %[[C:.*]] | ||
; NORMAL-NEXT: i32 20, label %[[D:.*]] | ||
; NORMAL-NEXT: ], !prof [[PROF2:![0-9]+]] | ||
; NORMAL: [[BB1:.*:]] | ||
; NORMAL-NEXT: br label %[[B]] | ||
; NORMAL: [[B]]: | ||
; NORMAL-NEXT: ret void | ||
; NORMAL: [[DEFAULT]]: | ||
; NORMAL-NEXT: ret void | ||
; NORMAL: [[C]]: | ||
; NORMAL-NEXT: ret void | ||
; NORMAL: [[D]]: | ||
; NORMAL-NEXT: ret void | ||
; | ||
%i = icmp eq i32 %cond, 0 | ||
br i1 %i, label %a, label %b | ||
a: | ||
switch i32 %cond, label %default [ | ||
i32 10, label %c | ||
i32 20, label %d | ||
] | ||
br label %b | ||
b: | ||
ret void | ||
default: | ||
ret void | ||
c: | ||
ret void | ||
d: | ||
ret void | ||
} | ||
;. | ||
; TEST: [[PROF0]] = !{!"function_entry_count", i64 1000} | ||
; TEST: [[PROF1]] = !{!"branch_weights", i32 3, i32 5} | ||
; TEST: [[PROF2]] = !{!"branch_weights", i32 5, i32 7, i32 11} | ||
;. | ||
; NORMAL: [[PROF0]] = !{!"function_entry_count", i64 1000} | ||
; NORMAL: [[PROF1]] = !{!"branch_weights", i32 3, i32 5} | ||
; NORMAL: [[PROF2]] = !{!"branch_weights", i32 1, i32 1, i32 1} | ||
;. | ||
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: | ||
; CHECK: {{.*}} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.