From 531c987feccc78b91eec921675cca05767fa94f3 Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 30 Jun 2016 23:50:18 +0000 Subject: [PATCH] LoadStoreVectorizer: Check skipFunction first. Also add test I forgot to add to r274296. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274299 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | 8 ++++---- test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp index 880be650ef3..567e8e6eb1d 100644 --- a/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp +++ b/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp @@ -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().getAAResults(); DominatorTree &DT = getAnalysis().getDomTree(); ScalarEvolution &SE = getAnalysis().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(); } diff --git a/test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll b/test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll index 42166f9986b..141e20a1f83 100644 --- a/test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll +++ b/test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll @@ -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 +} -- 2.50.0