[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment. And as another strawman / discussion-started I put up D158680 where I use `!{"branch_weights", i32 1, i32 0}` to represent likely branches and the actual "LikelyWeight" mostly becomes an internal implementation detail of the BranchProba

[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment. > On the other hand, I dislike exposing some internal detail of a pass. I think the question to ask is whether a concept like "likely branch" or "unlikely branch" shouldn't be more universal and not be a pass internal detail? Otherwise it feels like my patches and other

[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment. > My initial reaction to this was that we should keep the > --unlikely-branch-weights flag available I don't feel strongly about it and can put it back. But can you give some reasoning? I only see this flag having a real use to express small ratios like 3:2 which doesn'

[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added a comment. My initial reaction to this was that we should keep the `--unlikely-branch-weights` flag available, even if we decide to move forward with the other changes. but given that you haven't had to update many tests, I think its probably fine to go this way. Probably just a

[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB added a comment. Putting this out as a strawman/RFC. Should we add this function to allow LLVM passes to construct "likely"/"unlikely" branch_weights metadata? (I need this in D158642 and D157462 ) Repository: rG LL

[PATCH] D158668: Add getLikelyBranchWeight helper function

2023-08-23 Thread Matthias Braun via Phabricator via cfe-commits
MatzeB created this revision. MatzeB added reviewers: lebedev.ri, spatel, davidxl, wenlei, hoy, paulkirth. Herald added subscribers: StephenFan, modimo, hiraditya, mcrosier. Herald added a project: All. MatzeB requested review of this revision. Herald added subscribers: llvm-commits, cfe-commits, w