https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81813

            Bug ID: 81813
           Summary: Inefficient stack pointer adjustment
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jpoimboe at redhat dot com
  Target Milestone: ---

Created attachment 41968
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41968&action=edit
fs_pin.i

With GCC 7.1, the kernel's object code static analysis tool (objtool) found
this unusual method of adjusting the stack pointer in the kernel:

   2cc:   48 8d 4c 24 08          lea    0x8(%rsp),%rcx
   2d1:   48 89 cc                mov    %rcx,%rsp

The value in %rcx was never used afterwards.  It would be faster and more
straightforward to just add 8 to %rsp.

To recreate:

  gcc -mno-sse -mpreferred-stack-boundary=3 -O2 -c -o fs_pin.o fs_pin.i

Reply via email to