]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/69454 (ix86_expand_prologue internal compiler error: Segmentation fault)
authorJakub Jelinek <jakub@gcc.gnu.org>
Thu, 4 Feb 2016 09:02:01 +0000 (10:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 4 Feb 2016 09:02:01 +0000 (10:02 +0100)
PR target/69454
* config/i386/i386.c (convert_scalars_to_vector): Remove
stack alignment fixes.
(ix86_option_override_internal): Disable TARGET_STV if stack
might not be aligned enough.
(ix86_minimum_alignment): Assert that TARGET_STV is false.

* gcc.target/i386/pr69454-1.c: New test.
* gcc.target/i386/pr69454-2.c: New test.

From-SVN: r233128

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr69454-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr69454-2.c [new file with mode: 0644]

index 5a06f6735cbc51c19d4473ac9a6991e274dbda54..1bbb60529329ce41c50892e0a3b163513e15848c 100644 (file)
@@ -1,3 +1,14 @@
+2016-02-04  Jakub Jelinek  <jakub@redhat.com>
+           Ilya Enkovich  <enkovich.gnu@gmail.com>
+           H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/69454
+       * config/i386/i386.c (convert_scalars_to_vector): Remove
+       stack alignment fixes.
+       (ix86_option_override_internal): Disable TARGET_STV if stack
+       might not be aligned enough.
+       (ix86_minimum_alignment): Assert that TARGET_STV is false.
+
 2016-02-04  Victoria Stepanyan  <victoria.stepanyan@amd.com>
 
        * gcc/config/i386/x86-tune.def: Disable default prefetching 
index dbef1fcd530d96d39bf04d1bd940e983608fbd7c..366325441f93789e59068ff3a0e72d430660d2e6 100644 (file)
@@ -3588,16 +3588,6 @@ convert_scalars_to_vector ()
   bitmap_obstack_release (NULL);
   df_process_deferred_rescans ();
 
-  /* Conversion means we may have 128bit register spills/fills
-     which require aligned stack.  */
-  if (converted_insns)
-    {
-      if (crtl->stack_alignment_needed < 128)
-       crtl->stack_alignment_needed = 128;
-      if (crtl->stack_alignment_estimated < 128)
-       crtl->stack_alignment_estimated = 128;
-    }
-
   return 0;
 }
 
@@ -5453,6 +5443,13 @@ ix86_option_override_internal (bool main_args_p,
     opts->x_target_flags |= MASK_VZEROUPPER;
   if (!(opts_set->x_target_flags & MASK_STV))
     opts->x_target_flags |= MASK_STV;
+  /* Disable STV if -mpreferred-stack-boundary=2 or
+     -mincoming-stack-boundary=2 - the needed
+     stack realignment will be extra cost the pass doesn't take into
+     account and the pass can't realign the stack.  */
+  if (ix86_preferred_stack_boundary < 64
+      || ix86_incoming_stack_boundary < 64)
+    opts->x_target_flags &= ~MASK_STV;
   if (!ix86_tune_features[X86_TUNE_AVX256_UNALIGNED_LOAD_OPTIMAL]
       && !(opts_set->x_target_flags & MASK_AVX256_SPLIT_UNALIGNED_LOAD))
     opts->x_target_flags |= MASK_AVX256_SPLIT_UNALIGNED_LOAD;
@@ -29323,7 +29320,10 @@ ix86_minimum_alignment (tree exp, machine_mode mode,
   if ((mode == DImode || (type && TYPE_MODE (type) == DImode))
       && (!type || !TYPE_USER_ALIGN (type))
       && (!decl || !DECL_USER_ALIGN (decl)))
-    return 32;
+    {
+      gcc_checking_assert (!TARGET_STV);
+      return 32;
+    }
 
   return align;
 }
index b050772ece8fcfa98f833c0124355f07f87c14f2..a28ead2a0739f5c7f5ec3bfe202b8aaf902ec40e 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-04  Ilya Enkovich  <enkovich.gnu@gmail.com>
+
+       PR target/69454
+       * gcc.target/i386/pr69454-1.c: New test.
+       * gcc.target/i386/pr69454-2.c: New test.
+
 2016-02-03  Martin Sebor  <msebor@redhat.com>
 
        PR c++/69251
diff --git a/gcc/testsuite/gcc.target/i386/pr69454-1.c b/gcc/testsuite/gcc.target/i386/pr69454-1.c
new file mode 100644 (file)
index 0000000..12ecfd3
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -msse2 -mno-accumulate-outgoing-args -mpreferred-stack-boundary=2" } */
+
+typedef struct { long long w64[2]; } V128;
+extern V128* fn2(void);
+long long a;
+V128 b;
+void fn1() {
+  V128 *c = fn2();
+  c->w64[0] = a ^ b.w64[0];
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr69454-2.c b/gcc/testsuite/gcc.target/i386/pr69454-2.c
new file mode 100644 (file)
index 0000000..28bab93
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile { target { ia32 } } } */
+/* { dg-options "-O2 -mpreferred-stack-boundary=2" } */
+
+extern void fn2 ();
+long long a, b;
+
+void fn1 ()
+{
+  long long c = a;
+  a = b ^ a;
+  fn2 ();
+  a = c;
+}