<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - want -fomit-frame-pointer by default on PowerPC"
   href="https://bugs.llvm.org/show_bug.cgi?id=41094">41094</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>want -fomit-frame-pointer by default on PowerPC
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>OpenBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kernigh@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21609" name="attach_21609" title="default -fomit-frame-pointer for PowerPC">attachment 21609</a> <a href="attachment.cgi?id=21609&action=edit" title="default -fomit-frame-pointer for PowerPC">[details]</a></span>
default -fomit-frame-pointer for PowerPC

Right now, when clang targets PowerPC with optimizations, clang defaults to
-fomit-frame-pointer for Linux and NetBSD, but not for other targets.  The
attached patch (for llvm-project.git master) changes the default to
-fomit-frame-pointer for all PowerPC targets.

I want this because I am targeting 32-bit PowerPC OpenBSD, where gcc already
uses -fomit-frame-pointer by default.  All targets except Darwin have a similar
System V ELF ABI, so if -fomit-frame-pointer works for Linux and NetBSD, it
would probably work for FreeBSD and OpenBSD.  (It might work for Darwin, but
"Darwin is no longer supported for PowerPC" in llvm's PPCTargetMachine.)  The
frame pointer r31, when it exists, is almost always an extra copy of the stack
pointer r1.

Consider this code:   void nothing(void) {}

`clang -target powerpc-openbsd -O3 -S nothing.c` now emits

        stwu 1, -16(1)  # allocate stack frame
        stw 31, 12(1)   # save old r31
        mr 31, 1        # set frame pointer r31 = stack pointer r1
        lwz 31, 12(1)   # restore old r31
        addi 1, 1, 16   # free stack frame
        blr             # return

With -fomit-frame-pointer or with the patch, clang emits only

        blr

Beware that -fno-omit-frame-pointer doesn't work; this patch doesn't fix that. 
In the near future, I will backport the patch to clang 7 and compile more code.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>