<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 --- - Bugpoint's basic block extraction produce codes that get rejected by the verifier"
   href="https://llvm.org/bugs/show_bug.cgi?id=28803">28803</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bugpoint's basic block extraction produce codes that get rejected by the verifier
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </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>bugpoint
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>feishenniubi@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>This is a direct follow-up of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - DwarfEHPrepare pass crashed when trying to obtain function personality"
   href="show_bug.cgi?id=28799">https://llvm.org/bugs/show_bug.cgi?id=28799</a> 

ResumeInst needs to be in a function with a personality. However, bugpoint
doesn't respect that constraint when trying to perform basic block extraction.

Here's how I got the error:
<span class="quote">> bugpoint -run-llc -safe-run-llc test.ll -loop-unroll -gcc=clang++</span >

And here's the output:

Read input file      : 'test.ll'
*** All input ok
Running selected passes on program to test for crash: Success!
Initializing execution environment: Found llc:
/home/grieve/LLVM/GSoC/Testing/debugBuild/bin/llc
Running the code generator to test for a crash: <llc>
Generating reference output from raw program: <llc><llc><CC><program>
Reference output is: bugpoint.reference.out-9b386e1

*** Checking the code generator...
<llc><CC><program>
*** Output matches: Debugging miscompilation!
Checking to see if '' compiles correctly: <llc><CC><program> yup.
Checking to see if '-loop-unroll' compiles correctly: <llc><CC><program> nope.

*** Found miscompiling pass: -loop-unroll
Emitted bitcode to 'bugpoint-passinput.bc'

*** You can reproduce the problem with: opt bugpoint-passinput.bc -loop-unroll
Checking to see if the program is misoptimized when these functions are run
through the pass: main _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
_ZNSt11_Deque_baseIdSaIdEE17_M_initialize_mapEm
_ZNSt11_Deque_baseIdSaIdEE15_M_create_nodesEPPdS3_ __clang_call_terminate
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.
Checking to see if the program is misoptimized when these functions are run
through the pass: _ZNSt11_Deque_baseIdSaIdEE17_M_initialize_mapEm
_ZNSt11_Deque_baseIdSaIdEE15_M_create_nodesEPPdS3_ __clang_call_terminate
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
yup.
Checking to see if the program is misoptimized when these functions are run
through the pass: main _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.
Checking to see if the program is misoptimized when this function is run
through the pass: _ZNSt5dequeIdSaIdEE18_M_fill_initializeERKd
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
yup.
Checking to see if the program is misoptimized when this function is run
through the pass: main
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
nope.

*** The following function is being miscompiled:  main
Extracted a loop from the breaking portion of the program.
<llc><CC><program>  Testing after loop extraction:
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc><CC><program>
yup.
*** Loop extraction masked the problem.  Undoing.
Checking to see if the program is misoptimized when all blocks are extracted.
ResumeInst needs to be in a function with a personality
  resume { i8*, i32 } %eh.lpad-body
LLVM ERROR: Broken function found, compilation aborted!
*** Basic Block extraction failed, please report a bug!
Emitted bitcode to 'bugpoint-basicblockextractfail.bc'
Checking to see if the program is misoptimized when all but these 31 blocks are
extracted: entry for.cond.cleanup .noexc lpad.i lpad.i.ehcleanup_crit_edge
if.then.i.i26 if.then.i.i26.invoke.cont.i.i31_crit_edge
for.body.i.i.i30.preheader for.body.i.i.i30
for.body.i.i.i30.for.body.i.i.i30_crit_edge ...


I've attached both test.ll and bugpoint-basicblockextractfail.ll for reference.</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>