<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:sebpop@gmail.com" title="Sebastian Pop <sebpop@gmail.com>"> <span class="fn">Sebastian Pop</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Regression(r275401): assert while building ffmpeg"
   href="https://llvm.org/bugs/show_bug.cgi?id=28551">bug 28551</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Regression(r275401): assert while building ffmpeg"
   href="https://llvm.org/bugs/show_bug.cgi?id=28551#c9">Comment # 9</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Regression(r275401): assert while building ffmpeg"
   href="https://llvm.org/bugs/show_bug.cgi?id=28551">bug 28551</a>
              from <span class="vcard"><a class="email" href="mailto:sebpop@gmail.com" title="Sebastian Pop <sebpop@gmail.com>"> <span class="fn">Sebastian Pop</span></a>
</span></b>
        <pre>Which explains the crashes all over the place: the std::sort of today's libcxx
is inefficient as it calls the compare function on the same element:

            // known that *(__i - 1) < *__m
            // known that __i <= __m
            while (true)
            {
                // __m still guards upward moving __i
                while (__comp(*__i, *__m))
                    ++__i;
                // It is now known that a guard exists for downward moving __j
                while (!__comp(*--__j, *__m))
                    ;
                if (__i > __j)
                    break;
                swap(*__i, *__j);
                ++__n_swaps;
                // It is known that __m != __j
                // If __m just moved, follow it
                if (__m == __i)
                    __m = __j;
                ++__i;
            }

In particular this "if (__m == __i)" should be above the first call to
__comp().
Maybe some other places.

As the buildbots are not bootstrapping their libc++, there is not much I can do
to avoid all the users of Apple toolchains to see the assert failing.

I will remove the assert that I have in the GVNHoist code, and open a libcxx
bug for inefficiencies in the std::sort() algorithm.</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>