Improving bugpoint

I've made quite a bit of progress getting bugpoint to work with
our (non-gcc) tools. In fact I caught the alignment bug I
recently posted about using it. But it's not there yet. In
particular, I am seeing this scenario a lot (comments in brackets):

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

[ Good! This is progress! ]

*** You can reproduce the problem with: opt bugpoint-passinput.bc -instcombine
Checking to see if the program is misoptimized when these functions are run
through the pass: main sub0_ init_
Removing function main
Removing function sub0_
Removing function init_
  Optimizing functions being tested: done.
  Checking to see if the merged program executes correctly: <llc>
About to run: llc -o bugpoint-test-program.bc.llc.s -f
bugpoint-test-program.bc
<cray>
About to run: ftn bugpoint-test-program.bc.llc.s -c -o
bugpoint-test-program.bc.llc.s.cray.o-yIVqrc
<cray>
About to run: ftn bugpoint-test-program.bc.llc.s.cray.o-yIVqrc -o
bugpoint-test-program.bc.llc.s.cray.exe -lm

Error running tool:
  ftn bugpoint-test-program.bc.llc.s.cray.o-yIVqrc -o
bugpoint-test-program.bc.llc.s.cray.exe -lm
/opt/xt-asyncpe/2.0.5/bin/ftn: INFO: native target is being used
bugpoint-test-program.bc.llc.s.cray.o-yIVqrc: In function `red09_':
(.text+0x48): undefined reference to `__unnamed_1_0'

[ and lots more of the same ]

*** Debugging code generator crash!

[ Uh..no, this is a link failure... ]

It appears that bugpoint outflanks itself and removes some global symbols,
generating a link error and causing bugpoint to go off on a not-very-useful
code generator crash analysis. So I never actually end up getting a reduced
test case.

Has anyone else seen this kind of behavior before? What's a reasonable way to
address it? Should bugpoint try to detect link failures and then undo
whatever it did just before the link failure?

Thanks for a great tool. I'm happy to help make it better!

                                              -Dave

I've made quite a bit of progress getting bugpoint to work with
our (non-gcc) tools. In fact I caught the alignment bug I
recently posted about using it. But it's not there yet.

Cool.

It appears that bugpoint outflanks itself and removes some global symbols,
generating a link error and causing bugpoint to go off on a not-very-useful
code generator crash analysis. So I never actually end up getting a reduced
test case.

This occurs when you have functions/globals with no name (i.e. F- >setName("")).

This might be 718 – bugpoint crashes on stripped bc files

The basic fix is for bugpoint to add names to any unnamed symbols before it starts grinding.

-Chris