LoadStoreVectorizer: Check skipFunction first.

Also add test I forgot to add to r274296.

llvm-svn: 274299
This commit is contained in:
Matt Arsenault 2016-06-30 23:50:18 +00:00
parent c73850c702
commit 079d0f19a2
2 changed files with 14 additions and 4 deletions

View File

@ -154,14 +154,14 @@ Pass *llvm::createLoadStoreVectorizerPass(unsigned VecRegSize) {
}
bool LoadStoreVectorizer::runOnFunction(Function &F) {
// Don't vectorize when the attribute NoImplicitFloat is used.
if (skipFunction(F) || F.hasFnAttribute(Attribute::NoImplicitFloat))
return false;
AliasAnalysis &AA = getAnalysis<AAResultsWrapperPass>().getAAResults();
DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree();
ScalarEvolution &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE();
// Don't vectorize when the attribute NoImplicitFloat is used.
if (F.hasFnAttribute(Attribute::NoImplicitFloat) || skipFunction(F))
return false;
Vectorizer V(F, AA, DT, SE, VecRegSize);
return V.run();
}

View File

@ -10,3 +10,13 @@ define void @optnone(i32 addrspace(1)* %out) noinline optnone {
store i32 456, i32 addrspace(1)* %out
ret void
}
; CHECK-LABEL: @do_opt(
; CHECK: store <2 x i32>
define void @do_opt(i32 addrspace(1)* %out) {
%out.gep.1 = getelementptr i32, i32 addrspace(1)* %out, i32 1
store i32 123, i32 addrspace(1)* %out.gep.1
store i32 456, i32 addrspace(1)* %out
ret void
}