Commit 4d14c1f4 by Richard Kenner Committed by Richard Kenner

tree-ssa-dom.c (extract_range_from_cond): Deal with variable bounds on types.

	* tree-ssa-dom.c (extract_range_from_cond): Deal with variable bounds
	on types.

From-SVN: r107182
parent e259b3c2
2005-11-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 2005-11-18 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree-ssa-dom.c (extract_range_from_cond): Deal with variable bounds
on types.
* expr.c (expand_expr_real): Don't call record_block_change unless * expr.c (expand_expr_real): Don't call record_block_change unless
ib_boundaries_block is non-null ib_boundaries_block is non-null
......
...@@ -3203,10 +3203,7 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p) ...@@ -3203,10 +3203,7 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
record ranges for enumerations. Presumably this is due to record ranges for enumerations. Presumably this is due to
the fact that they're rarely used directly. They are typically the fact that they're rarely used directly. They are typically
cast into an integer type and used that way. */ cast into an integer type and used that way. */
if (TREE_CODE (type) != INTEGER_TYPE if (TREE_CODE (type) != INTEGER_TYPE)
/* We don't know how to deal with types with variable bounds. */
|| TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
|| TREE_CODE (TYPE_MAX_VALUE (type)) != INTEGER_CST)
return 0; return 0;
switch (TREE_CODE (cond)) switch (TREE_CODE (cond))
...@@ -3223,12 +3220,19 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p) ...@@ -3223,12 +3220,19 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
case GE_EXPR: case GE_EXPR:
low = op1; low = op1;
/* Get the highest value of the type. If not a constant, use that
of its base type, if it has one. */
high = TYPE_MAX_VALUE (type); high = TYPE_MAX_VALUE (type);
if (TREE_CODE (high) != INTEGER_CST && TREE_TYPE (type))
high = TYPE_MAX_VALUE (TREE_TYPE (type));
inverted = 0; inverted = 0;
break; break;
case GT_EXPR: case GT_EXPR:
high = TYPE_MAX_VALUE (type); high = TYPE_MAX_VALUE (type);
if (TREE_CODE (high) != INTEGER_CST && TREE_TYPE (type))
high = TYPE_MAX_VALUE (TREE_TYPE (type));
if (!tree_int_cst_lt (op1, high)) if (!tree_int_cst_lt (op1, high))
return 0; return 0;
low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1); low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1);
...@@ -3238,11 +3242,15 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p) ...@@ -3238,11 +3242,15 @@ extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
case LE_EXPR: case LE_EXPR:
high = op1; high = op1;
low = TYPE_MIN_VALUE (type); low = TYPE_MIN_VALUE (type);
if (TREE_CODE (low) != INTEGER_CST && TREE_TYPE (type))
low = TYPE_MIN_VALUE (TREE_TYPE (type));
inverted = 0; inverted = 0;
break; break;
case LT_EXPR: case LT_EXPR:
low = TYPE_MIN_VALUE (type); low = TYPE_MIN_VALUE (type);
if (TREE_CODE (low) != INTEGER_CST && TREE_TYPE (type))
low = TYPE_MIN_VALUE (TREE_TYPE (type));
if (!tree_int_cst_lt (low, op1)) if (!tree_int_cst_lt (low, op1))
return 0; return 0;
high = int_const_binop (MINUS_EXPR, op1, integer_one_node, 1); high = int_const_binop (MINUS_EXPR, op1, integer_one_node, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment