LLVM 3.3 Improves Its Loop Vectorizer
Introduced in LLVM 3.2 was a loop vectorizer. From the earlier Phoronix article on the subject, "The LLVM Loop Vectorizer is the second vectorizer for the compiler infrastructure after its Basic Block Vectorizer for dealing with straight-line code. The Loop Vectorizer is meant to widen instructions in an original loop for operating on multiple consecutive loop iterations. As mentioned in the earlier Phoronix articles on the subject, this feature isn't enabled by default with the forthcoming LLVM 3.2 but can be flipped on via the -mllvm -vectorize-loops compiler switches." The functionality has also been described by LLVM developers.
I did run benchmarks of the LLVM Loop Vectorizer back in December and it could enhance the performance for some workloads. There's previously been talk of enabling the vectorizer by default in LLVM 3.3, but that hasn't happened yet.
What has happened in the code-base of LLVM 3.3 are a number of improvements to this loop vectorizer. With the latest development code, the LLVM 3.3 Loop Vectorizer now supports loops with an unknown trip count, run-time checks of pointers, reductions/inductions, if conversions, pointer induction variables, reverse iterators, vectorization of mixed types, vectorization of function calls, and partial unrolling during vectorization.
These LLVM 3.3 improvements should allow the loop vectorizer to be used more widely and applicable to more code-bases. Benchmarks of the LLVM Loop Vectorizer improvements are forthcoming as we begin to look at the LLVM/Clang 3.3 performance changes at Phoronix.