> Is the change to pass wi::to_widest really necessary? I think it has a > runtime penalty.
Yes, because there is no == operator for a (tree, int) pair. Is there a cheap way to convert a tree back into a wide_int? wi::to_wide? Or a combination with decompose? Otherwise you can use eq_p, but this means that all other callers of fits_to_tree_p are affected: template <typename T> bool wi::fits_to_tree_p (const T &x, const_tree type) { /* Short-circuit boolean types since various transformations assume that they can only take values 0 and 1. */ if (TREE_CODE (type) == BOOLEAN_TYPE) return eq_p (x, 0) || eq_p (x, 1); instead of just int_fits_type_p (but I don't really know if there is a penalty associated with eq_p here). -- Eric Botcazou