summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-uninit.c
diff options
context:
space:
mode:
authorVladislav Ivanishin <vlad@ispras.ru>2019-04-29 19:47:17 +0000
committerJeff Law <law@gcc.gnu.org>2019-04-29 13:47:17 -0600
commit5c1b3334a2f59492f57e32c2ddab06d22941a3f3 (patch)
treed4b1b9cbc6efbdfe196d089bc4d58fe9686df6d7 /gcc/tree-ssa-uninit.c
parent95c33590c88563c03e20618af60ed18eda3013aa (diff)
tree-ssa-uninit.c (is_pred_expr_subset_of): Correctly handle cases where cond2 is NE_EXPR.
* tree-ssa-uninit.c (is_pred_expr_subset_of): Correctly handle cases where cond2 is NE_EXPR. (is_value_included_in): Update comment. * gcc.dg/uninit-25-gimple.c: New test. * gcc.dg/uninit-25.c: New test. * gcc.dg/uninit-26.c: New test. * gcc.dg/uninit-27-gimple.c: New test. From-SVN: r270660
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
-rw-r--r--gcc/tree-ssa-uninit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c
index 55a55a05c96..831587854c6 100644
--- a/gcc/tree-ssa-uninit.c
+++ b/gcc/tree-ssa-uninit.c
@@ -1011,8 +1011,7 @@ get_cmp_code (enum tree_code orig_cmp_code, bool swap_cond, bool invert)
return tc;
}
-/* Returns true if VAL falls in the range defined by BOUNDARY and CMPC, i.e.
- all values in the range satisfies (x CMPC BOUNDARY) == true. */
+/* Returns whether VAL CMPC BOUNDARY is true. */
static bool
is_value_included_in (tree val, tree boundary, enum tree_code cmpc)
@@ -1488,11 +1487,17 @@ is_pred_expr_subset_of (pred_info expr1, pred_info expr2)
if (expr2.invert)
code2 = invert_tree_comparison (code2, false);
+ if (code2 == NE_EXPR && code1 == NE_EXPR)
+ return false;
+
+ if (code2 == NE_EXPR)
+ return !is_value_included_in (expr2.pred_rhs, expr1.pred_rhs, code1);
+
if ((code1 == EQ_EXPR || code1 == BIT_AND_EXPR) && code2 == BIT_AND_EXPR)
return (wi::to_wide (expr1.pred_rhs)
== (wi::to_wide (expr1.pred_rhs) & wi::to_wide (expr2.pred_rhs)));
- if (code1 != code2 && code2 != NE_EXPR)
+ if (code1 != code2)
return false;
if (is_value_included_in (expr1.pred_rhs, expr2.pred_rhs, code2))