<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 - Divergence Analysis: undetected divergence in unstructured control"
   href="https://bugs.llvm.org/show_bug.cgi?id=37185">37185</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Divergence Analysis: undetected divergence in unstructured control
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>Global Analyses
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>moll@cs.uni-saarland.de
          </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=20207" name="attach_20207" title="LIT tests for NVPTX and AMDGPU">attachment 20207</a> <a href="attachment.cgi?id=20207&action=edit" title="LIT tests for NVPTX and AMDGPU">[details]</a></span>
LIT tests for NVPTX and AMDGPU

The divergence analysis fails to detect divergent phi nodes in the presence of
unstructured, divergent control flow.

The attached LIT tests trigger the bug in NVPTX and AMDGPU kernels.

The divergence analysis marks a phi node as divergent if its parent block is
the immediate post-dominator of a divergent branch (sync dependence). The
immediate post-dominator of a branch is the only point of reconvergence in
structured control flow. This assumption does not hold in unstructured control
flow:

"""
entry:
  divergent branch to B and C
B:
  uniform branch to C and D
C:
  %phi.var.hidden = phi .. <- undetected DIVERGENT phi
  br D
D:
  %phi.var = phi .. <- detected DIVERGENT phi in IPostDom of entry
  ret
"""

D is the immediate post-dominator of entry. However, threads that diverge at
the branch in entry can reconverge at block C. The phi node %phi.var.hidden in
turn becomes divergent.</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>