+2008-09-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37508
+ * tree-vrp.c (simplify_truth_ops_using_ranges): Also allow -1.
+
2008-09-15 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.md (movsf_ie): Fix length for TARGET_SH2A.
+2008-09-16 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37508
+ * gcc.dg/tree-ssa/pr37508.c: New testcase.
+
2008-09-15 Aldy Hernandez <aldyh@redhat.com>
* g++.old-deja/g++.brendan/crash16.C: Function name is the correct
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+struct foo1 {
+ int i:1;
+};
+struct foo2 {
+ unsigned i:1;
+};
+
+int test1 (struct foo1 *x)
+{
+ if (x->i == 0)
+ return 1;
+ else if (x->i == -1)
+ return 1;
+ return 0;
+}
+
+int test2 (struct foo2 *x)
+{
+ if (x->i == 0)
+ return 1;
+ else if (x->i == -1)
+ return 1;
+ return 0;
+}
+
+int test3 (struct foo1 *x)
+{
+ if (x->i == 0)
+ return 1;
+ else if (x->i == 1)
+ return 1;
+ return 0;
+}
+
+int test4 (struct foo2 *x)
+{
+ if (x->i == 0)
+ return 1;
+ else if (x->i == 1)
+ return 1;
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "Folding" 4 "vrp1" { xfail *-*-* } } } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */
/* Exclude anything that should have been already folded. */
gcc_assert (rhs_code == EQ_EXPR || rhs_code == NE_EXPR
|| rhs_code == TRUTH_XOR_EXPR);
- gcc_assert (integer_zerop (op1) || integer_onep (op1));
+ gcc_assert (integer_zerop (op1) || integer_onep (op1)
+ || integer_all_onesp (op1));
/* Limit the number of cases we have to consider. */
if (rhs_code == EQ_EXPR)