We have found that the calls to verifyFunction can take up to 66% of the time spent in llvm::LoopVectorizePass::processLoop. For some source files, verifyFunction took around 10% of the total compile time.
This patch guards the calls to verifyFunction with the EXPENSIVE_CHECKS macro.