<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 - Really bad codegen for libc++ vector"
   href="https://bugs.llvm.org/show_bug.cgi?id=35637">35637</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Really bad codegen for libc++ vector
          </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>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>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the following code:

        #include <vector>
        #include <memory>

        auto f1()
        {
                return std::vector<unsigned char>( 1920*1080*4 );
        }

        auto f2()
        {
                return new std::vector<unsigned char>( 1920*1080*4 );
        }

        int main() {}

clang generates fine code for "f1", noticing that it has to zero 8+MB of data,
and calling memset to do so.

For "f2", it generates a loop. Clearing a byte? at a time, and recalculating
the pointer each time.  Reproduced on godbolt with "-std=c++1z -Wall -W -O3
-stdlib=libc++" with both clang 5.0 and clang trunk.</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>