<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 - Incorrect block frequencies for profile-optimized compilation after jump threading"
   href="https://bugs.llvm.org/show_bug.cgi?id=38492">38492</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Incorrect block frequencies for profile-optimized compilation after jump threading
          </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>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>dcallahan@fb.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20660" name="attach_20660" title="test case">attachment 20660</a> <a href="attachment.cgi?id=20660&action=edit" title="test case">[details]</a></span>
test case

This bug is reduced from the spec2017 602.gcc test which is compiled with a
sample-based profiling. 

After jump threading  the default compilation generates an wild execution
frequency for some blocks. If jump threading is disabled
(-jump-threading-threshold=0) then more reasonable frequencies are generated.
For example, diffing the output of -debug-only=block-freq illustrates

<  - while.body.i74: float = 1342177279.8, scaled = 28633115303.3, int =
28633115303
---
<span class="quote">>  - while.body.i74: float = 60.15625113, scaled = 1283.333358, int = 1283</span >

The relative frequency of 60 is plausible while the other is not.

Jump threading updates the branch weights in two places. Curiously one place is
explicitly disabled when the there are existing profile weights while the other
explicitly requires profiling to already be present. These choices interact
poorly when the first example finds on profile branch weights and so creates
them in a context the second seems it should not have them.</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>