using bugpoint to find miscompilation/code generation problems?

Sorry to ask about a documented use of bugpoint, but I am having trouble understanding what to do.

I would like to be able to use bugpoint to simplify test cases, when the symptom is a run time difference in the testprogram behavior. That looks like what is described in the documentation as “miscompilation or perhaps code generation problems”. There are examples in the LLVM doc showing runs with -output argument to supply the expected output, -args to give the program arguments, and -tool-args give arguments to, in this case, llc. The problem is that I can’t seem to get bugpoint to run this way, and its probably my fault.

Can someone give me an example for LLVM 4.2.1 that runs bugpoint in this way:

  1. I want to run a test compiled to bitcode (this is the bugpoint input). I have this.
  2. The bitcode compiled with llc to a .s file by bugpoint.
  3. Then the .s file linked with gcc by bugpoint.
  4. The final file run automatically by bugpoint against oggenc output compiled by llvm-gcc straight to native code

It then iterates until a simplified test case is created whose output is still different from that of the native code.

thanks,
-David

Hi David,

It then iterates until a simplified test case is created whose output is still different from that of the native code.

isn't that exactly what you want: a small test-case that shows the problem?

Ciao,

Duncan.

Yes, its what I want, but I can’t figure out how to get bugpoint to accomplish this.

-David

Hi David,

Yes, its what I want, but I can't figure out how to get bugpoint to accomplish this.

ah, I thought that was you describing what you had achieved! There
are basically two cases: (1) you have unoptimized bitcode which works,
but the optimizers turn it into something that doesn't work (or the
optimizers crash). Try:
   bugpoint -std-compile-opts unoptimized.bc
Otherwise (2) you have some bitcode that is correct, but the code
generators are doing something wrong with it (eg: crashing). Try
   bugpoint -run-llc file.bc

Ciao,

Duncan.