<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 - SyncDependenceAnalysis: Crash on loop with split block"
   href="https://bugs.llvm.org/show_bug.cgi?id=42473">42473</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SyncDependenceAnalysis: Crash on loop with split block
          </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>pjcoup@gmail.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=22176" name="attach_22176" title="SyncDependenceAnalysis crash">attachment 22176</a> <a href="attachment.cgi?id=22176&action=edit" title="SyncDependenceAnalysis crash">[details]</a></span>
SyncDependenceAnalysis crash

Compare the attached r0.ll (working) and r1.ll (exposes crash):
Reproduce with opt -mtriple amdgcn-unknown-amdhsa -analyze -divergence
-use-gpu-divergence-analysis r1.ll

--- r0.ll       2019-07-01 15:17:57.372404000 -0700
+++ r1.ll       2019-07-01 15:16:57.458441000 -0700
@@ -26,7 +26,7 @@
   br label %while.end

 while.body:
-  %i.026 = phi i32 [ %inc, %if.end ], [ 0, %while.body.preheader ]
+  %i.026 = phi i32 [ %inc, %if.end.while.body_crit_edge ], [ 0,
%while.body.preheader ]
   %call3 = tail call  i32 @gf1(i32 0) #4
   %cmp4 = icmp ult i32 %call3, 10
   %arrayidx6 = getelementptr inbounds i32, i32 addrspace(4)* %A, i32 %i.026
@@ -50,7 +50,10 @@
   store i32 %storemerge, i32 addrspace(4)* %arrayidx10, align 4
   %inc = add nuw nsw i32 %i.026, 1
   %exitcond = icmp ne i32 %inc, %0
-  br i1 %exitcond, label %while.body, label %while.end.loopexit
+  br i1 %exitcond, label %if.end.while.body_crit_edge, label
%while.end.loopexit
+
+if.end.while.body_crit_edge:
+  br label %while.body</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>