]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/91605 (ICE in ix86_avx256_split_vector_move_misalign, at config...
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Mon, 2 Sep 2019 14:26:26 +0000 (14:26 +0000)
committerBernd Edlinger <edlinger@gcc.gnu.org>
Mon, 2 Sep 2019 14:26:26 +0000 (14:26 +0000)
2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR middle-end/91605
        * expr.c (addr_expr_of_non_mem_decl_p_1): Refactor into...
        (non_mem_decl_p): ...this.
        (mem_ref_refers_to_non_mem_p): Handle DECL_P as well ase MEM_REF.
        (expand_assignment): Call mem_ref_referes_to_non_mem_p
        unconditionally as before.

testsuite:
2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

        PR middle-end/91605
        * g++.target/i386/pr91605.C: New test.

From-SVN: r275320

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.target/i386/pr91605.C [new file with mode: 0644]

index 25f8478ad983ffa6ae6e440cb3701c87a362130a..3a0f9178c8b84fce26514af452151868823dd4f8 100644 (file)
@@ -1,3 +1,12 @@
+2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR middle-end/91605
+       * expr.c (addr_expr_of_non_mem_decl_p_1): Refactor into...
+       (non_mem_decl_p): ...this.
+       (mem_ref_refers_to_non_mem_p): Handle DECL_P as well ase MEM_REF.
+       (expand_assignment): Call mem_ref_referes_to_non_mem_p
+       unconditionally as before.
+
 2019-09-02  Eric Botcazou  <ebotcazou@adacore.com>
 
        PR target/91323
index 022b571fb79a905d4992d23b9a107c0f47c4c806..3c3f15a0f776cb996b3e53ba2ccb5c426d15dcf6 100644 (file)
@@ -4942,37 +4942,46 @@ get_bit_range (poly_uint64_pod *bitstart, poly_uint64_pod *bitend, tree exp,
   *bitend = *bitstart + tree_to_poly_uint64 (DECL_SIZE (repr)) - 1;
 }
 
-/* Returns true if ADDR is an ADDR_EXPR of a DECL that does not reside
-   in memory and has non-BLKmode.  DECL_RTL must not be a MEM; if
-   DECL_RTL was not set yet, return NORTL.  */
+/* Returns true if BASE is a DECL that does not reside in memory and
+   has non-BLKmode.  DECL_RTL must not be a MEM; if
+   DECL_RTL was not set yet, return false.  */
 
 static inline bool
-addr_expr_of_non_mem_decl_p_1 (tree addr, bool nortl)
+non_mem_decl_p (tree base)
 {
-  if (TREE_CODE (addr) != ADDR_EXPR)
-    return false;
-
-  tree base = TREE_OPERAND (addr, 0);
-
   if (!DECL_P (base)
       || TREE_ADDRESSABLE (base)
       || DECL_MODE (base) == BLKmode)
     return false;
 
   if (!DECL_RTL_SET_P (base))
-    return nortl;
+    return false;
 
   return (!MEM_P (DECL_RTL (base)));
 }
 
-/* Returns true if the MEM_REF REF refers to an object that does not
+/* Returns true if REF refers to an object that does not
    reside in memory and has non-BLKmode.  */
 
 static inline bool
 mem_ref_refers_to_non_mem_p (tree ref)
 {
-  tree base = TREE_OPERAND (ref, 0);
-  return addr_expr_of_non_mem_decl_p_1 (base, false);
+  tree base;
+
+  if (TREE_CODE (ref) == MEM_REF
+      || TREE_CODE (ref) == TARGET_MEM_REF)
+    {
+      tree addr = TREE_OPERAND (ref, 0);
+
+      if (TREE_CODE (addr) != ADDR_EXPR)
+       return false;
+
+      base = TREE_OPERAND (addr, 0);
+    }
+  else
+    base = ref;
+
+  return non_mem_decl_p (base);
 }
 
 /* Expand an assignment that stores the value of FROM into TO.  If NONTEMPORAL
@@ -5004,7 +5013,7 @@ expand_assignment (tree to, tree from, bool nontemporal)
        || TREE_CODE (to) == TARGET_MEM_REF
        || DECL_P (to))
       && mode != BLKmode
-      && (DECL_P (to) || !mem_ref_refers_to_non_mem_p (to))
+      && !mem_ref_refers_to_non_mem_p (to)
       && ((align = get_object_alignment (to))
          < GET_MODE_ALIGNMENT (mode))
       && (((icode = optab_handler (movmisalign_optab, mode))
index 3f46b84c0bc17ce24c662eea304711620572a2a6..a7c473efc4058d2b6271c732cd21d90323673a97 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR middle-end/91605
+       * g++.target/i386/pr91605.C: New test.
+
 2019-09-02  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/91632
diff --git a/gcc/testsuite/g++.target/i386/pr91605.C b/gcc/testsuite/g++.target/i386/pr91605.C
new file mode 100644 (file)
index 0000000..8bceedb
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fpack-struct -mavx" } */
+
+struct A {
+  __attribute__((__vector_size__(4 * sizeof(double)))) double data;
+};
+struct B {
+  A operator*(B);
+};
+void fn1() {
+  B x, y;
+  x *y;
+}