-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Unsafe.Unlikely (Assume) draft implementation #33043
Conversation
The mono parts look ok to me. |
I guess it's more an API design question, e.g. in the original issue it's proposed to be |
Thanks. Is there any reason this need to be a PR? Can you not just link to the relevant commit from that issue? This doesn't seem actionable. |
Ok, will close it if there won't be any interest in some short term. Next time will use commits instead if you don't mind. |
Thanks. Mainly I want to keep the PR list to things that folks should act on by getting them merged or closed. We're currently pushing 190 PRs, and from I can see, most folks are ignoring anything after the first page or two. I'd love to drive down the number, and getting there means not having unactionable PRs sitting around purely for discussion purposes. For non-committed ideas, I'd like for those discussions to be had on the relevant issues; linking to commits from those issues is a good thing to do, of course. |
@stephentoub if you to close an issue in dotnet/runtime dealing with Mono code, please try to close the corresponding mono/mono mirrored PR as well to keep things tidy. |
Ok, will do. If the mirror is able to open PRs, it'd be great if it can close them, too. |
Just a quick draft for #4966 for both RyuJIT CoreCLR and Mono-LLVM (maybe it will help to push it forward since it's 4 years old).
It allows programmers to give hints to JIT about branches' probabilities, e.g. to avoid goto hacks like this in perf critical code.
Sample:
Codegen without
Unlikely
:Codgen with
Unlikely
(this is what this PR emits)Also, I implemented it for Mono-LLVM (I use
@llvm.expect.i32
intrinsic, which is emitted when you use__builtin_expect
in C/C++)Mono-LLVM without
Unlikely
(macOS)Mono-LLVM with
Unlikely
(macOS)cc @jkotas