<html>
    <head>
      <base href="https://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 --- - GVNHoist leads to miscompile of llvm test-suite SingleSource/Benchmarks/Misc/fbench.c"
   href="https://llvm.org/bugs/show_bug.cgi?id=28880">28880</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>GVNHoist leads to miscompile of llvm test-suite SingleSource/Benchmarks/Misc/fbench.c
          </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>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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>matze@braunis.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>GVN-hoist appears to miscompile SingleSource/Benchmarks/Misc/fbench.c as this
builder:

<a href="http://lab.llvm.org:8080/green/job/Performance_O3flto/">http://lab.llvm.org:8080/green/job/Performance_O3flto/</a>

is broken after r277786 "GVN-hoist: enable by default".

Citing Sebastians analysis: "

 think there is a problem with the MemorySSA when compiling fbench with -Ofast
The problem appears with -mllvm -gvn-max-hoisted=63, (at 62 the
program is not miscompiled.)
before.ll is the MSSA dump at 62 and after.ll is the MSSA for 63.

We end up hoisting two loads past a store, and the loads do not link
to the store: they are both liveOnEntry:

; MemoryUse(liveOnEntry)
 %19 = load double, double* @axis_slope_angle, align 8, !tbaa !5

and

; MemoryUse(liveOnEntry)
 %22 = load double, double* @axis_slope_angle, align 8, !tbaa !5

past a store to the global variable:

; 7 = MemoryDef(liveOnEntry)
 store double 0.000000e+00, double* @axis_slope_angle, align 8, !tbaa !5
"</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>