<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 - Nondeterminstic optimization on macOS, unknown where though"
   href="https://bugs.llvm.org/show_bug.cgi?id=43909">43909</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Nondeterminstic optimization on macOS, unknown where though
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>gk@torproject.org, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The tor project has a bug open -
<a href="https://trac.torproject.org/projects/tor/ticket/32053">https://trac.torproject.org/projects/tor/ticket/32053</a> - that their builds on
macOS are not reproducible. The source of this nondeterminism in the build is
the Rust source code in Firefox. After digging in that thread (there's a lot of
discussion, but feel free to skip over it) we've concluded that the LLVM
optimization passes for a bitcode file are the source of the nondeterminism.

The files hosted at <a href="https://people.torproject.org/~gk/misc/32053/">https://people.torproject.org/~gk/misc/32053/</a> are produced
by rustc itself, and style.no-opt.bc has been seen to optimize to style1.bc and
style2.bc. Locally I've checked the latest commit of LLVM and this command
produces different hashes:

    opt -O3 style.no-opt.bc -o foo.bc

Using LLVM trunk I'm seeing two sha1 hashes show up:

* 045fb2b4a581418e0287e208e1d4633804b7e2db
* 6887c6a5d427aa792b51188c2e27521392a1d048

One is more likely than the other, but this appears to be at least one source
of nondeterminism in the build of Tor.

Unfortunately the `style.no-opt.bc` file is 90MB large (!) which means that I'm
still in the process of reducing this to something more digestable. Running
`opt -O3` once on the file takes a few minutes, though, so my attempts at using
`bugpoint` are likely going to take quite awhile. In the meantime though I
wanted to open up this bug to see if others know better how to debug this
and/or minimize it. 

If more information is needed about the non-determinism, please just let me
know as well!</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>