On Fri, Jan 15, 2016 at 03:32:33PM -0700, Jeff Law wrote:
> +bool
> +ssa_name_has_boolean_range (tree op)
> +{
> + gcc_assert (TREE_CODE (op) == SSA_NAME);
> +
> + /* Boolean types always have a range [0..1]. */
> + if (TREE_CODE (TREE_TYPE (op)) == BOOLEAN_TYPE)
> + return true;
> +
> + /* An integral type with a single bit of precision. */
> + if (INTEGRAL_TYPE_P (TREE_TYPE (op))
> + && TYPE_UNSIGNED (TREE_TYPE (op))
> + && TYPE_PRECISION (TREE_TYPE (op)) == 1)
> + return true;
> +
> + /* An integral type with more precision, but the object
> + only takes on values [0..1] as determined by VRP
> + analysis. */
> + if (INTEGRAL_TYPE_P (TREE_TYPE (op))
> + && (TYPE_PRECISION (TREE_TYPE (op)) > 1
> + || TYPE_UNSIGNED (TREE_TYPE (op)))
I think this || TYPE_UNSIGNED (TREE_TYPE (op)) is useless.
Because, if TYPE_PRECISION (TREE_TYPE (op)) > 1, then both signed and
unsigned is fine, and if precision is 1, then already the earlier if
handled it, and precision 0 is hopefully invalid.
> + && wi::eq_p (get_nonzero_bits (op), 1))
> + return true;
> +
> + return false;
> +}
Jakub