[PATCH] D12341: add llvm.unpredictable intrinsic and lower it to metadata
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 10:35:03 PDT 2015
spatel added reviewers: bob.wilson, kuba.
spatel added a comment.
In http://reviews.llvm.org/D12341#234320, @hfinkel wrote:
> My understanding is that the way that llvm.expect was implemented is considered to be a mistake that we're now stuck with for backwards-compatibility reasons (and we could fix this and auto-upgrade, but no one has bothered to do this yet, in part, because until recently we still had too many problems with dropping the profiling metadata, and so there were bigger fish to fry).
[Adding Bob Wilson (quoted below) and Jakub Staszak (author of the original llvm.expect patch)]
The only reference for the llvm.expect implementation I found was here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20110704/123438.html
"One of the reasons we decided to implement builtin_expect this way is to allow some simple propagation of builtin_expect calls that are not directly inside conditionals. You haven't implemented that yet, but early CSE should help when the time comes."
If everyone agrees that metadata from the front-end is now sufficient, then I'll certainly abandon this patch for something much simpler. I still think we would want a distinct metadata type for 'unpredictable' rather than using 'prof' metadata because there are no special values of prof data that could be used to indicate unpredictability. Ie, just because both sides of a branch have the same weight, does not necessarily make them unpredictable.
http://reviews.llvm.org/D12341
More information about the llvm-commits
mailing list