Commit fb4b60c6 by Vladislav Ivanishin Committed by Alexander Monakov

tree-ssa-uninit: clean up is_value_included_in

2019-05-15  Vladislav Ivanishin  <vlad@ispras.ru>

	* tree-ssa-uninit.c (is_value_included_in): Remove is_unsigned and merge
	semantically equivalent branches (left over after prior refactorings).

From-SVN: r271207
parent 6b943512
2019-05-15 Vladislav Ivanishin <vlad@ispras.ru>
* tree-ssa-uninit.c (is_value_included_in): Remove is_unsigned and merge
semantically equivalent branches (left over after prior refactorings).
2019-05-15 Richard Biener <rguenther@suse.de> 2019-05-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/88828 PR tree-optimization/88828
......
...@@ -1017,45 +1017,26 @@ static bool ...@@ -1017,45 +1017,26 @@ static bool
is_value_included_in (tree val, tree boundary, enum tree_code cmpc) is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
{ {
bool inverted = false; bool inverted = false;
bool is_unsigned;
bool result; bool result;
/* Only handle integer constant here. */ /* Only handle integer constant here. */
if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST) if (TREE_CODE (val) != INTEGER_CST || TREE_CODE (boundary) != INTEGER_CST)
return true; return true;
is_unsigned = TYPE_UNSIGNED (TREE_TYPE (val));
if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR) if (cmpc == GE_EXPR || cmpc == GT_EXPR || cmpc == NE_EXPR)
{ {
cmpc = invert_tree_comparison (cmpc, false); cmpc = invert_tree_comparison (cmpc, false);
inverted = true; inverted = true;
} }
if (is_unsigned) if (cmpc == EQ_EXPR)
{ result = tree_int_cst_equal (val, boundary);
if (cmpc == EQ_EXPR) else if (cmpc == LT_EXPR)
result = tree_int_cst_equal (val, boundary); result = tree_int_cst_lt (val, boundary);
else if (cmpc == LT_EXPR)
result = tree_int_cst_lt (val, boundary);
else
{
gcc_assert (cmpc == LE_EXPR);
result = tree_int_cst_le (val, boundary);
}
}
else else
{ {
if (cmpc == EQ_EXPR) gcc_assert (cmpc == LE_EXPR);
result = tree_int_cst_equal (val, boundary); result = tree_int_cst_le (val, boundary);
else if (cmpc == LT_EXPR)
result = tree_int_cst_lt (val, boundary);
else
{
gcc_assert (cmpc == LE_EXPR);
result = (tree_int_cst_equal (val, boundary)
|| tree_int_cst_lt (val, boundary));
}
} }
if (inverted) if (inverted)
......
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