[LLVMdev] llvm-stress for fuzzing llvm

Rotem, Nadav nadav.rotem at intel.com
Sun Feb 26 03:51:04 PST 2012


Hi, 

Compiling lots of 'junk' helps in catching bugs.  I added a new tool (located under llvm/tools/llvm-stress) for generating random LL files.  The tool can be used to test different llvm components using various compilation flags.  Until now, I only found bugs in the codegen, and not in general llvm optimizations. This probably means that the generated tests are currently too simple for the higher-level optimizations. 

The command line below generates a random ll file, and llc compiles this file. It often crashes. 

./llvm-stress -seed $RANDOM -o tmp.ll -size 1000 ; ./llc tmp.ll -mcpu=corei7-avx -mattr=+avx -o /dev/null 

The "-seed" flag sets the initial seed to be used by the random function.  I implemented a simple portable 'random' function so that the result should be identical on all platforms. The initial seed also appears in the name of the generated function.  The "-size" parameter sets the size of the generated random file. 

Nadav
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-dev mailing list