Simplify LLVM passes.

Use a typedef to minimize difference between LLVM 3.1 and Â3.2+.
Use IRBuilder method CreateMemCpy.
Check for pthreads library.

This fixes a link error on my ARM devices.
Use logic of LLVM to detect pthread library.

But still need to check if LLVM uses pthreads.
Check for terminfo libary.

This fixes another link error on my ARM device.
ldmd2 requires -lpthread and -lcurses, too.

This is a change to the LLVM CMake files from LLVM 3.5.
Cache result of DtoFunctionType.
Add CMAKE_DL_LIBS to link command.
Fix a problem with the new array bounds check code.
Merge remote-tracking branch 'origin/master' into merge-2.064

Conflicts:
	gen/arrays.cpp