diff options
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r-- | gcc/tree-vrp.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 7e267aa2a54..a34dea905d3 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1117,29 +1117,28 @@ compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p) if (!POINTER_TYPE_P (TREE_TYPE (val1))) { - if (TREE_CODE (val1) != INTEGER_CST - || TREE_CODE (val2) != INTEGER_CST) - { - if (poly_tree_p (val1) && poly_tree_p (val2)) - { - if (must_eq (wi::to_poly_widest (val1), - wi::to_poly_widest (val2))) - return 0; - if (must_lt (wi::to_poly_widest (val1), - wi::to_poly_widest (val2))) - return -1; - if (must_gt (wi::to_poly_widest (val1), - wi::to_poly_widest (val2))) - return 1; - } - return -2; - } - /* We cannot compare overflowed values. */ if (TREE_OVERFLOW (val1) || TREE_OVERFLOW (val2)) return -2; - return tree_int_cst_compare (val1, val2); + if (TREE_CODE (val1) == INTEGER_CST + && TREE_CODE (val2) == INTEGER_CST) + return tree_int_cst_compare (val1, val2); + + if (poly_int_tree_p (val1) && poly_int_tree_p (val2)) + { + if (must_eq (wi::to_poly_widest (val1), + wi::to_poly_widest (val2))) + return 0; + if (must_lt (wi::to_poly_widest (val1), + wi::to_poly_widest (val2))) + return -1; + if (must_gt (wi::to_poly_widest (val1), + wi::to_poly_widest (val2))) + return 1; + } + + return -2; } else { |