Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Bugpoint's basic block extraction produce codes that get rejected by the verifier #28798

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR28803
Status NEW
Importance P normal
Reported by Jia Chen (feishenniubi@gmail.com)
Reported on 2016-08-01 16:30:25 -0700
Last modified on 2016-08-01 16:31:43 -0700
Version trunk
Hardware PC Linux
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments bugpoint-basicblockextractfail.ll (16141 bytes, application/octet-stream)
test.ll (43444 bytes, application/octet-stream)
Blocks
Blocked by
See also
This is a direct follow-up of https://llvm.org/bugs/show_bug.cgi?id=28799

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:
> bugpoint -run-llc -safe-run-llc test.ll -loop-unroll -gcc=clang++

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.
Quuxplusone commented 8 years ago

Attached bugpoint-basicblockextractfail.ll (16141 bytes, application/octet-stream): IR at extraction failure point

Quuxplusone commented 8 years ago

Attached test.ll (43444 bytes, application/octet-stream): The original bug-triggering input file