-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ctx_prof] Handle case when no root is in this Module. (#107463)
If none of the functions in this `Module` are roots in the contextual profile, we can't use it and should just return the `{}` case.
- Loading branch information
Showing
2 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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,63 @@ | ||
; REQUIRES: x86_64-linux | ||
; | ||
; Check that, if none of the roots in the profile are defined in the module, the | ||
; profile is treated as empty (i.e. "none provided") | ||
; | ||
; RUN: rm -rf %t | ||
; RUN: split-file %s %t | ||
; RUN: llvm-ctxprof-util fromJSON --input=%t/profile.json --output=%t/profile.ctxprofdata | ||
; RUN: opt -passes='require<ctx-prof-analysis>,print<ctx-prof-analysis>' -ctx-profile-printer-level=everything \ | ||
; RUN: %t/example.ll -S 2>&1 | FileCheck %s | ||
|
||
; CHECK: No contextual profile was provided | ||
; | ||
; This is the reference profile, laid out in the format the json formatter will | ||
; output it from opt. | ||
;--- profile.json | ||
[ | ||
{ | ||
"Counters": [ | ||
9 | ||
], | ||
"Guid": 12341 | ||
}, | ||
{ | ||
"Counters": [ | ||
5 | ||
], | ||
"Guid": 12074870348631550642 | ||
}, | ||
{ | ||
"Callsites": [ | ||
[ | ||
{ | ||
"Counters": [ | ||
6, | ||
7 | ||
], | ||
"Guid": 728453322856651412 | ||
} | ||
] | ||
], | ||
"Counters": [ | ||
1 | ||
], | ||
"Guid": 11872291593386833696 | ||
} | ||
] | ||
;--- example.ll | ||
declare void @bar() | ||
|
||
define void @an_entrypoint(i32 %a) !guid !0 { | ||
%t = icmp eq i32 %a, 0 | ||
br i1 %t, label %yes, label %no | ||
|
||
yes: | ||
call void @bar() | ||
ret void | ||
no: | ||
ret void | ||
} | ||
|
||
attributes #0 = { noinline } | ||
!0 = !{ i64 1000 } |