Hey everyone. It sounds like 426 people are in for a fun weekend. It's
possible that some of you may even have bugs in your code (I know, I know,
not YOU... If this is you, read on...
You might be interested in trying out the 'bugpoint' tool. It can help
you when your pass crashes on a testcase. Merely tell it the input
testcase and the name of your pass, and it will try to reduce the testcase
as much as possible, trying to make your debugging a bit easier.
Usage is just like opt or analyze, but slightly more general:
$ bugpoint foo1.bc foo2.ll -pass1 -pass2 -pass3
You can give it an arbitrary number of .ll or .bc files, and you can give
it 'opt' passes or 'analyze' passes. Of course you can use -load just
like opt or analyze.
Note that this tool will currently only help you if your pass _crashes_.
It cannot yet help with infinite loops or miscompilations. However it is
particularly useful on large testcases like spec benchmarks, but is quite
useful even on smaller multi-function testcases.
Caveats:
1. I'm quite busy this week, so I won't really be able to help if you run
into problems with bugpoint. No warrantee expressed or implied. If
it breaks you get to keep both pieces. If it gives you a rash, sorry,
just don't scratch.
2. However, I am interested in fixing the bugs. If you run into problems
with bugpoint, please post information to the llvmbugs@cs.uiuc.edu
mailing list. When I have time, I will get the bugs fixed.
3. There is already one bugfix that is unlikely to be in your tree:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20021202/001860.html
if you get assertions in ConstantArray or ConstantStruct when running
bugpoint, this is the patch. Thanks to Misha for pointing out the
problem.
4. If bugpoint helps, I would like to hear about it. If you have
suggestions for improvement, please send them my way. Support for
debugging infinite loops and miscompilations is already planned
though.
Anyway, good luck with your projects. I hope you don't all hate LLVM too
much after the experience...
-Chris