This fixes two issues that Rainer ran into on the x86 solaris port.

The x86 Solaris port handles the frame pointer differently than other
x86 ports.  It requires frame pointers in cases that others do not --
it's a lot like aarch64 and just needed a trivial update to handle x86
solaris specially in the target-supports.exp bits.

Second, the x86 does not include space for pushed registers in its
computation of the amount of space to allocate (since the allocation is
done by the push).

This is an allocation, just one that implicitly probes as well.
Regardless even though its an allocation the debug dumps which the
testsuite reads indicated no stack was allocated in a function where it
clearly expected an allocation.  Thus the failure.

The fix is trivial.  If there are callee saved registers, then we have a
small allocation with no probing and we reflect that in the dump output.

That fixes the Solaris issues that I can test with a cross.  Installing
on the trunk.

Jeff
commit 6063f7b33dc608a95d1d1bb53c564d668fe8bb51
Author: Jeff Law <l...@redhat.com>
Date:   Thu Sep 21 16:03:21 2017 -0600

            * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash):
            Fix dump output if the only stack space is for pushed registers.
    
            * lib/target-supports.exp
            (check_effective_target_frame_pointer_for_non_leaf): Add
            case for x86 Solaris.

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 36d5ec05a1f..26c388b3565 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-21  Jeff Law  <l...@redhat.com>
+
+       * config/i386/i386.c (ix86_adjust_stack_and_probe_stack_clash):
+       Fix dump output if the only stack space is for pushed registers.
+
 2017-09-21  Richard Sandiford  <richard.sandif...@linaro.org>
 
        * config/spu/spu.c (spu_sched_adjust_cost): Update after renaming
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index aeafd0d5d21..270ee557872 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -13946,7 +13946,13 @@ ix86_adjust_stack_and_probe_stack_clash (const 
HOST_WIDE_INT size)
      no probes are needed.  */
   if (!size)
     {
-      dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false);
+      /* However, the allocation of space via pushes for register
+        saves could be viewed as allocating space, but without the
+        need to probe.  */
+      if (m->frame.nregs || m->frame.nsseregs || frame_pointer_needed)
+        dump_stack_clash_frame_info (NO_PROBE_SMALL_FRAME, true);
+      else
+       dump_stack_clash_frame_info (NO_PROBE_NO_FRAME, false);
       return;
     }
 
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7b4805218c0..04f0c186635 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-09-21  Rainer Orth  <r...@cebitec.uni-bielefeld.de>
+
+       * lib/target-supports.exp
+       (check_effective_target_frame_pointer_for_non_leaf): Add
+       case for x86 Solaris.
+
 2017-09-21  Paul Thomas  <pa...@gcc.gnu.org>
 
        PR fortran/78512
diff --git a/gcc/testsuite/lib/target-supports.exp 
b/gcc/testsuite/lib/target-supports.exp
index b7fe5c0d724..887a801bbd8 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8657,6 +8657,12 @@ proc check_effective_target_frame_pointer_for_non_leaf { 
} {
   if { [istarget aarch*-*-*] } {
        return 1
   }
+
+  # Solaris/x86 defaults to -fno-omit-frame-pointer.
+  if { [istarget i?86-*-solaris*] || [istarget x86_64-*-solaris*] } {
+    return 1
+  }
+
   return 0
 }
 

Reply via email to