<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - le32-unknown-nacl target does not optimize simple struct return values as primitive returns"
   href="http://llvm.org/bugs/show_bug.cgi?id=18863">18863</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>le32-unknown-nacl target does not optimize simple struct return values as primitive returns
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12072" name="attach_12072" title="sret.cpp">attachment 12072</a> <a href="attachment.cgi?id=12072&action=edit" title="sret.cpp">[details]</a></span>
sret.cpp

The attached sret.cpp demonstrates a simple struct with a nondefault
constructor.

When compiled to IR for the default x86_64 target on Ubuntu 12.04 AMD64, it
optimizes the S struct into a simple i32.  See the attached sret-amd64.ll.

When compiled to IR for the le32-unknown-nacl target, the struct is not
optimized away.  See the attached sret-le32.ll.

Both files were generated with:

clang --std=c++11 -O2 -emit-llvm -target le32-unknown-nacl -c -Wall -o sret.bc
sret.cpp && llvm-dis -o sret-le32.ll sret.bc 

clang --std=c++11 -O2 -emit-llvm -c -Wall -o sret.bc sret.cpp && llvm-dis -o
sret-amd64.ll sret.bc 

This reproduces with both clang 3.3 and clang 3.4.

The lack of this optimization penalizes use of utility types, such as
InternedString and IntrusiveSmartPtr, used frequently in our
Emscripten-compiled project.</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>