https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47661
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot
gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Drea Pinski <pinskia at gcc dot gnu.org> ---
I have an idea on fixing this.
tree_predict_by_opcode:
```
op0 = gimple_cond_lhs (stmt);
op1 = gimple_cond_rhs (stmt);
cmp = gimple_cond_code (stmt);
type = TREE_TYPE (op0);
val = expr_expected_value_1 (boolean_type_node, op0, cmp, op1,
&predictor, &probability);
if (val && TREE_CODE (val) == INTEGER_CST)
{
HOST_WIDE_INT prob = get_predictor_value (predictor, probability);
if (integer_zerop (val))
prob = REG_BR_PROB_BASE - prob;
predict_edge (then_edge, predictor, prob);
}
...
/* Comparisons with 0 are often used for booleans and there is
nothing useful to predict about them. */
else if (integer_zerop (op0) || integer_zerop (op1))
;
```
Does not look back for boolean types.
For single use booleans, it makes sense to look back to its definition I think.
The question is becomes how to handle `a & b` for boolean types, do we look
back for both or just one of them?