Since I’m going to try to use LLVM for GHC registerised build I need to make sure it’s kind of the best build I can get on the target hardware. To explain more: LLVM is really a picky project from the C++ compiler point of view. If you read some part of LLVM Getting Started manual (here) you will see a lot of references for “miscompilation” and such. Fortunately LLVM even in standard distribution comes with nice testsuite which you can use to verify quality of the build. So when I installed freescale’s recommended image it provides ubuntu’s gcc 4.4.3-1 compiler (I don’t know exactly now, since I’ve changed the compiler later, see below). When I tried to compile LLVM 2.9 by this I’ve got quite a lot of tests failing. To be precise 58 tests failing, this is not so nice. I’ve looked around and found that this gcc/ubuntu version defaults to thumb code generation, so next step was to enforce ARM code generation (-marm mode option) and viola I’ve been on 18 tests failures! Much better, but still not best since I remember in the past I’ve been able to get into just 1 failure, but this was probably on the older Ubuntu! Anyway, this Ubuntu compiler was tough so I started to downgrade the compiler and to make long story short I’ve ended on:

$ gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp --disable-werror --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)

Mark this version since it’s able to compile LLVM 2.9 into a build where only one test is failing!

$ make check
llvm[0]: Running test suite
make[1]: Entering directory `/export/home/karel/src/obj-llvm/test'
Making a new site.exp file...
Making LLVM 'lit.site.cfg' file...
Making LLVM unittest 'lit.site.cfg' file...
( ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 1024000 ; \
/export/home/karel/src/llvm-2.9/utils/lit/lit.py -s -v . )
FAIL: LLVM :: CodeGen/Thumb/select.ll (1593 of 5840)
******************** TEST 'LLVM :: CodeGen/Thumb/select.ll' FAILED ********************
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep beq | /export/home/karel/src/obj-llvm/Release/bin/count 1
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep bgt | /export/home/karel/src/obj-llvm/Release/bin/count 1
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep blt | /export/home/karel/src/obj-llvm/Release/bin/count 3
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep ble | /export/home/karel/src/obj-llvm/Release/bin/count 1
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep bls | /export/home/karel/src/obj-llvm/Release/bin/count 1
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -march=thumb | grep bhi | /export/home/karel/src/obj-llvm/Release/bin/count 1
/export/home/karel/src/obj-llvm/Release/bin/llc < /export/home/karel/src/llvm-2.9/test/CodeGen/Thumb/select.ll -mtriple=thumb-apple-darwin | grep __ltdf2
Exit Code: 1
Command Output (stderr):
Expected 3 lines, got 1.

Testing Time: 928.90s
Failing Tests (1):
LLVM :: CodeGen/Thumb/select.ll

Expected Passes : 5249
Expected Failures : 48
Unsupported Tests : 542
Unexpected Failures: 1
make[1]: *** [check-local-lit] Error 1
make[1]: Leaving directory `/export/home/karel/src/obj-llvm/test'
make: *** [check] Error 2

and in addition this is just a Thumb code generator error and I’m certainly not going to target Thumb! i.e. rather ARM or Thumb2 of course…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s