<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 - JumpThreading misoptimization, only on glibc 2.26"
href="https://bugs.llvm.org/show_bug.cgi?id=36386">36386</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>JumpThreading misoptimization, only on glibc 2.26
</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>junbuml@codeaurora.org, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Hello! Over at rust-lang/rust we've recently upgraded to LLVM 6.0 (yay!) but
unfortunately have had a bit of a rocky time since then. We've been having
flaky
CI runs [1] that are spuriously failing on various platforms. This has been
notoriously difficult to reproduce so far, but I think we've started making
some
great progress!
This bug originally surfaced as a presumed miscompilation of rustc itself,
although I believe we've reduced it down to a much smaller test case at this
point. The odd part about this reproduction is it depends on whether LLVM, as
it's running, is using glibc 2.26 or not. When using glibc 2.26 a
miscompilation
occurs, and when using glibc 2.25 or prior the miscompilation does not occur.
I've personally been completely baffled by what's going on here. Valgrind
hasn't
reported much suspicious unfortunately. The one thing it did report, a
conditional jump on uninitialized memory, was diagnosed [2] as a spurious error
that likely isn't the root cause.
My local machine has glibc 2.23 installed, and I've been using Docker to
emulate
Ubuntu 18.04 and get glibc 2.26. I've been compiling LLVM locally with
assertions enabled and in release mode using Clang 4 as a compiler. Using the
same `opt` binary from this build (which was built against glibc 2.23) I then
get different results optimizing the input IR [3] depending on whether it runs
on Ubuntu 16.04 (glibc 2.23) or Ubuntu 18.04 (glibc 2.26). The output of each
run and their diff is here -- [4].
Jun I've cc'd you because when I ran a bisection on this error I was seeing it
came up with <a href="https://reviews.llvm.org/D30352">https://reviews.llvm.org/D30352</a> as a culprit. Reverting that patch
does indeed seem to fix the behavior locally, although that patch also doesn't
seem like it's doing anything wrong so I'd suspect that this was an existing
bug
perhaps. Would you be able to help us though in routing this to the proper
folks?
If any more information is needed please just let us know! I think we've worked
around this issue in our own builds for now at least so it's hopefully not
pressing on our end any more, but this seems like it may be good to fix
regardless!
[1]: <a href="https://github.com/rust-lang/rust/issues/48116">https://github.com/rust-lang/rust/issues/48116</a>
[2]: <a href="https://github.com/rust-lang/rust/issues/48116#issuecomment-365662392">https://github.com/rust-lang/rust/issues/48116#issuecomment-365662392</a>
[3]: <a href="https://gist.github.com/alexcrichton/c39d44ea1df7293b5a522293340be6ee">https://gist.github.com/alexcrichton/c39d44ea1df7293b5a522293340be6ee</a>
[4]: <a href="https://gist.github.com/alexcrichton/ac88a4a59576aeff929d568f16c5114d">https://gist.github.com/alexcrichton/ac88a4a59576aeff929d568f16c5114d</a></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>