]> granicus.if.org Git - llvm/commitdiff
LoadStoreVectorizer: Check skipFunction first.
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 30 Jun 2016 23:50:18 +0000 (23:50 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 30 Jun 2016 23:50:18 +0000 (23:50 +0000)
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
test/Transforms/LoadStoreVectorizer/AMDGPU/optnone.ll

index 880be650ef3bdc6756726f8d43fbe02c86717c4e..567e8e6eb1d53d552d7b23251939a0495827fce9 100644 (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();
 }
index 42166f9986bc2b2baefad7bb548b243a6dfc3eec..141e20a1f83c2112e4fdce2b5a72d5b3fa4a4816 100644 (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
+}