<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 --- - Divergence Analysis: Constant load in branch considered divergent"
   href="https://llvm.org/bugs/show_bug.cgi?id=25864">25864</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Divergence Analysis: Constant load in branch considered divergent
          </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>Linux
          </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>tstellar@gmail.com
          </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>Created <span class=""><a href="attachment.cgi?id=15479" name="attach_15479" title="Test case">attachment 15479</a> <a href="attachment.cgi?id=15479&action=edit" title="Test case">[details]</a></span>
Test case

I've run into this issue with the DivergenceAnalysis pass, and I'm not sure if
it is a bug or if it is expected behavior.  Attached is the test case, which
can be reproduced by applying this patch: <a href="http://reviews.llvm.org/D15608">http://reviews.llvm.org/D15608</a>

opt  -analyze -divergence -mtriple=amdgcn-- divergent-test.ll

The output I get from the divergence analysis pass is this:

DIVERGENT:  float %arg1
DIVERGENT:  %tmp2 = fcmp ueq float %arg1, 0.000000e+00
DIVERGENT:  br i1 %tmp2, label %bb7, label %bb3
DIVERGENT:  %tmp4 = phi i1 [ false, %bb7 ], [ true, %bb ]
DIVERGENT:  br i1 %tmp4, label %bb5, label %bb9
DIVERGENT:  %tmp6 = call float @llvm.SI.load.const(<16 x i8> %tmp, i32 16)

^ This last line is what I think it incorrect.  This is a constant load
intrinsic, which takes a non-divergent argument, so it shouldn't be divergent.
I have verified that AMDGPU's implementation of
TargetTransformInfo::isSourceOfDivergence() returns false for this intrinsic.

Based on brief debugging of the issue I think the problem may be that the
DivergenceAnalysis pass incorrectly things this test case contains a loop, but
I'm not really sure.</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>