]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR tree-optimization/60502 (ICE reassociation and vector types.)
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Apr 2014 09:35:39 +0000 (11:35 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Apr 2014 09:35:39 +0000 (11:35 +0200)
Backport from mainline
2014-03-12  Jakub Jelinek  <jakub@redhat.com>
    Marc Glisse  <marc.glisse@inria.fr>

PR tree-optimization/60502
* tree-ssa-reassoc.c (eliminate_not_pairs): Use build_all_ones_cst
instead of build_low_bits_mask.

* gcc.c-torture/compile/pr60502.c: New test.

2013-06-13  Marc Glisse  <marc.glisse@inria.fr>

* tree.c (build_all_ones_cst): New function.
* tree.h (build_all_ones_cst): Declare it.

2013-05-10  Marc Glisse  <marc.glisse@inria.fr>

* tree.c (build_minus_one_cst): New function.
* tree.h (build_minus_one_cst): Declare new function.

From-SVN: r209274

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-ssa-reassoc.c
gcc/tree.c
gcc/tree.h

index 4c6daa9ce7e5c1d35d934ae584e7260795f094b9..e6fd9b670883dde8ad021715197b25beb6769401 100644 (file)
@@ -1,3 +1,23 @@
+2014-04-10  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2014-03-12  Jakub Jelinek  <jakub@redhat.com>
+                   Marc Glisse  <marc.glisse@inria.fr>
+
+       PR tree-optimization/60502
+       * tree-ssa-reassoc.c (eliminate_not_pairs): Use build_all_ones_cst
+       instead of build_low_bits_mask.
+
+       2013-06-13  Marc Glisse  <marc.glisse@inria.fr>
+
+       * tree.c (build_all_ones_cst): New function.
+       * tree.h (build_all_ones_cst): Declare it.
+
+       2013-05-10  Marc Glisse  <marc.glisse@inria.fr>
+
+       * tree.c (build_minus_one_cst): New function.
+       * tree.h (build_minus_one_cst): Declare new function.
+
 2014-04-10  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
index d94f2a51078969dc5667ac25e64f008f9bdae924..2fe4b2b83e19920b07468ef2a80e10a40e33dbce 100644 (file)
@@ -1,6 +1,12 @@
 2014-04-10  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2014-03-12  Jakub Jelinek  <jakub@redhat.com>
+                   Marc Glisse  <marc.glisse@inria.fr>
+
+       PR tree-optimization/60502
+       * gcc.c-torture/compile/pr60502.c: New test.
+
        2014-03-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/60693
index 14eae6b3f7b05833bad29e9d53b7b1468ae3a32a..b3528391b857ae6a2ed0ae3250d3e4380665810c 100644 (file)
@@ -785,8 +785,7 @@ eliminate_not_pairs (enum tree_code opcode,
          if (opcode == BIT_AND_EXPR)
            oe->op = build_zero_cst (TREE_TYPE (oe->op));
          else if (opcode == BIT_IOR_EXPR)
-           oe->op = build_low_bits_mask (TREE_TYPE (oe->op),
-                                         TYPE_PRECISION (TREE_TYPE (oe->op)));
+           oe->op = build_all_ones_cst (TREE_TYPE (oe->op));
 
          reassociate_stats.ops_eliminated += ops->length () - 1;
          ops->truncate (0);
index 9075664954c4e17dfb8ba2fcb6068435298e1a24..006c48134d4ec6d3e77ed3e9235e30fe364e4548 100644 (file)
@@ -1619,6 +1619,60 @@ build_one_cst (tree type)
     }
 }
 
+/* Return an integer of type TYPE containing all 1's in as much precision as
+   it contains, or a complex or vector whose subparts are such integers.  */
+
+tree
+build_all_ones_cst (tree type)
+{
+  if (TREE_CODE (type) == COMPLEX_TYPE)
+    {
+      tree scalar = build_all_ones_cst (TREE_TYPE (type));
+      return build_complex (type, scalar, scalar);
+    }
+  else
+    return build_minus_one_cst (type);
+}
+
+/* Return a constant of arithmetic type TYPE which is the
+   opposite of the multiplicative identity of the set TYPE.  */
+
+tree
+build_minus_one_cst (tree type)
+{
+  switch (TREE_CODE (type))
+    {
+    case INTEGER_TYPE: case ENUMERAL_TYPE: case BOOLEAN_TYPE:
+    case POINTER_TYPE: case REFERENCE_TYPE:
+    case OFFSET_TYPE:
+      return build_int_cst (type, -1);
+
+    case REAL_TYPE:
+      return build_real (type, dconstm1);
+
+    case FIXED_POINT_TYPE:
+      /* We can only generate 1 for accum types.  */
+      gcc_assert (ALL_SCALAR_ACCUM_MODE_P (TYPE_MODE (type)));
+      return build_fixed (type, fixed_from_double_int (double_int_minus_one,
+                                                      TYPE_MODE (type)));
+
+    case VECTOR_TYPE:
+      {
+       tree scalar = build_minus_one_cst (TREE_TYPE (type));
+
+       return build_vector_from_val (type, scalar);
+      }
+
+    case COMPLEX_TYPE:
+      return build_complex (type,
+                           build_minus_one_cst (TREE_TYPE (type)),
+                           build_zero_cst (TREE_TYPE (type)));
+
+    default:
+      gcc_unreachable ();
+    }
+}
+
 /* Build 0 constant of type TYPE.  This is used by constructor folding
    and thus the constant should be represented in memory by
    zero(es).  */
index 2b93882d2167f791ec7d66c04cba29f911832e05..33d8c5d8be1c3830d4b187884d693320e171f502 100644 (file)
@@ -4760,6 +4760,8 @@ extern tree build_constructor_from_list (tree, tree);
 extern tree build_real_from_int_cst (tree, const_tree);
 extern tree build_complex (tree, tree, tree);
 extern tree build_one_cst (tree);
+extern tree build_minus_one_cst (tree);
+extern tree build_all_ones_cst (tree);
 extern tree build_zero_cst (tree);
 extern tree build_string (int, const char *);
 extern tree build_tree_list_stat (tree, tree MEM_STAT_DECL);