https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99946
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
Last reconfirmed| |2021-04-07
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
There's no pass doing all of this. There's ifcombine that could end up
turning it into
tem = likely(a>0) & unlikely(b>0);
if (tem)
g ();
and then RTL expansion might expand it to branchy code again.
But of course __builtin_expect is long gone then and we'll lose the
likelyness of the individual tests.
Still ifcombine has analysis logic as to "collecting" a complex predicate,
what's then missing is to "re-associate" the tests according to probability.
Which means implementing it in ifcombine should be feasible.