Add a flag vectorizer-maximize-bandwidth in loop vectorizer to enable using larger...
authorCong Hou <congh@google.com>
Mon, 2 Nov 2015 22:53:48 +0000 (22:53 +0000)
committerCong Hou <congh@google.com>
Mon, 2 Nov 2015 22:53:48 +0000 (22:53 +0000)
commitc895fd0d677be116efaac45af934b4270e4a35a1
treee1ed65a86b80aba115548ca85f4c4f2e1e0428ff
parent1e6387531effdc6c81476e047dd29a774726c144
Add a flag vectorizer-maximize-bandwidth in loop vectorizer to enable using larger vectorization factor.

To be able to maximize the bandwidth during vectorization, this patch provides a new flag vectorizer-maximize-bandwidth. When it is turned on, the vectorizer will determine the vectorization factor (VF) using the smallest instead of widest type in the loop. To avoid increasing register pressure too much, estimates of the register usage for different VFs are calculated so that we only choose a VF when its register usage doesn't exceed the number of available registers.

This is the second attempt to submit this patch. The first attempt got a test failure on ARM. This patch is updated to try to fix the failure (more specifically, by handling the case when VF=1).

Differential revision: http://reviews.llvm.org/D8943

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251850 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/X86/vector_max_bandwidth.ll [new file with mode: 0644]
test/Transforms/LoopVectorize/X86/vector_ptr_load_store.ll