<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 --- - Broken module: CleanupPadInst not the first non-PHI instruction in the block"
   href="https://llvm.org/bugs/show_bug.cgi?id=25326">25326</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broken module: CleanupPadInst not the first non-PHI instruction in the 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>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>alex@crichton.co
          </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=15166" name="attach_15166" title="failing IR">attachment 15166</a> <a href="attachment.cgi?id=15166&action=edit" title="failing IR">[details]</a></span>
failing IR

When running `llc` over the LLVM IR attached, it will emit:

CleanupPadInst not the first non-PHI instruction in the block.
  %cleanuppadi4.i.i.i = cleanuppad []
The unwind destination does not have an exception handling instruction!
  invoke fastcc void
@"_ZN3vec13_$LT$impl$GT$7reserve7reserve20h8370453893456365494E"(%"3.collections::vec::Vec<middle::ty::ProjectionPredicate>"*
noalias nonnull dereferenceable(12) %vectori4.i.i, i32 %227)
          to label %normal-return5.i.normal-return10.i_crit_edgei4.i.i unwind
label %unwind_custom_i4.i.i.i, !noalias !208
LLVM ERROR: Broken function found, compilation aborted!


When checking the IR, however, it looks like the `cleanuppad` instruction is
the first non-phi instruction in the block?


unwind_custom_i4.i.i.i:                   
  %.lcssa178 = phi %"..."* [ %175, %normal-return5i4.i.i.i ]
  %.pre.i.i.i.2672.i313i4.i.i.lcssa176 = phi %"..."* [
%.pre.i.i.i.2672.i313i4.i.i, %normal-return5i4.i.i.i ]
  %cleanuppadi4.i.i.i = cleanuppad []                                           
  br label %loop_body.i.i.i.28i4.i.i.i                                          

I wasn't really quite sure what was going wrong here, and it may be some
invalid IR elsewhere in the file (sorry, I couldn't get bugpoint to reduce it
further), but perhaps there's something odd going on?</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>