expected_value_to_br_prob buglet
Richard Henderson
rth@cygnus.com
Sat Apr 22 11:37:00 GMT 2000
Glibc is now using __builtin_expect in ld.so, which showed
up this bit of laziness.
r~
* predict.c (expected_value_to_br_prob): Don't bomb if op1 of
the collected condition is not a constant.
Index: gcc/predict.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/predict.c,v
retrieving revision 1.6
diff -c -p -d -r1.6 predict.c
*** predict.c 2000/04/21 16:19:20 1.6
--- predict.c 2000/04/22 18:30:01
*************** expected_value_to_br_prob ()
*** 248,256 ****
}
/* Collect the branch condition, hopefully relative to EV_REG. */
cond = XEXP (SET_SRC (PATTERN (insn)), 0);
cond = canonicalize_condition (insn, cond, 0, NULL, ev_reg);
! if (! cond || XEXP (cond, 0) != ev_reg)
continue;
/* Substitute and simplify. Given that the expression we're
--- 248,266 ----
}
/* Collect the branch condition, hopefully relative to EV_REG. */
+ /* ??? At present we'll miss things like
+ (expected_value (eq r70 0))
+ (set r71 -1)
+ (set r80 (lt r70 r71))
+ (set pc (if_then_else (ne r80 0) ...))
+ as canonicalize_condition will render this to us as
+ (lt r70, r71)
+ Could use cselib to try and reduce this further. */
cond = XEXP (SET_SRC (PATTERN (insn)), 0);
cond = canonicalize_condition (insn, cond, 0, NULL, ev_reg);
! if (! cond
! || XEXP (cond, 0) != ev_reg
! || GET_CODE (XEXP (cond, 1)) != CONST_INT)
continue;
/* Substitute and simplify. Given that the expression we're
More information about the Gcc-patches
mailing list