<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 - [SimplifyCFG] produces incorrect callbr's"
   href="https://bugs.llvm.org/show_bug.cgi?id=43222">43222</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[SimplifyCFG] produces incorrect callbr's
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Transformation Utilities
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ndesaulniers@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, natechancellor@gmail.com, srhines@google.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>4068
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22471" name="attach_22471" title="z.ll">attachment 22471</a> <a href="attachment.cgi?id=22471&action=edit" title="z.ll">[details]</a></span>
z.ll

With the attached test case, and new verifier check from
(<a href="https://reviews.llvm.org/D67196">https://reviews.llvm.org/D67196</a>) I observe a failure in SimplifyCFG:

$ opt --simplifycfg z.ll -o /dev/null
Indirect label missing from arglist.
  callbr void asm sideeffect "// XXX: ${0:l}", "X"(i8* blockaddress(@andy_test,
%if.then))
          to label %land.rhs.i [label %if.end]
in function andy_test
LLVM ERROR: Broken function found, compilation aborted!

the indirect label list `[label %if.end]`.

Attaching z2.ll, which is the post-simplyifycfg-ed version that violates the
invariant.

Looks like a simple phi is being replaced:

branch_test.exit:                                 ; preds = %entry, %land.rhs.i
  %0 = phi i1 [ true, %entry ], [ false, %land.rhs.i ]
  br i1 %0, label %if.end, label %if.then

where the blockaddress of %if.then is being updated correctly, but the indirect
label list is not.</pre>
        </div>
      </p>

        <div id="referenced">
          <hr style="border: 1px dashed #969696">
          <b>Referenced Bugs:</b>
          <ul>
              <li>
                [<a class="bz_bug_link 
          bz_status_CONFIRMED "
   title="CONFIRMED - [Meta] Compiling the Linux kernel with clang"
   href="https://bugs.llvm.org/show_bug.cgi?id=4068">Bug 4068</a>] [Meta] Compiling the Linux kernel with clang
              </li>
          </ul>
        </div>
        <br>

      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>