mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
[PM] Port LoadStoreVectorizer to the new pass manager.
Differential Revision: https://reviews.llvm.org/D54848 llvm-svn: 348570
This commit is contained in:
parent
dafa7c4e1d
commit
6da1480917
@ -206,7 +206,7 @@ void initializeLiveRangeShrinkPass(PassRegistry&);
|
||||
void initializeLiveRegMatrixPass(PassRegistry&);
|
||||
void initializeLiveStacksPass(PassRegistry&);
|
||||
void initializeLiveVariablesPass(PassRegistry&);
|
||||
void initializeLoadStoreVectorizerPass(PassRegistry&);
|
||||
void initializeLoadStoreVectorizerLegacyPassPass(PassRegistry&);
|
||||
void initializeLoaderPassPass(PassRegistry&);
|
||||
void initializeLocalStackSlotPassPass(PassRegistry&);
|
||||
void initializeLocalizerPass(PassRegistry&);
|
||||
|
27
include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
Normal file
27
include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
Normal file
@ -0,0 +1,27 @@
|
||||
//===- LoadStoreVectorizer.cpp - GPU Load & Store Vectorizer --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H
|
||||
#define LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H
|
||||
|
||||
#include "llvm/IR/PassManager.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class LoadStoreVectorizerPass : public PassInfoMixin<LoadStoreVectorizerPass> {
|
||||
public:
|
||||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
|
||||
};
|
||||
|
||||
/// Create a legacy pass manager instance of the LoadStoreVectorizer pass
|
||||
Pass *createLoadStoreVectorizerPass();
|
||||
|
||||
}
|
||||
|
||||
#endif /* LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H */
|
@ -157,6 +157,7 @@
|
||||
#include "llvm/Transforms/Utils/Mem2Reg.h"
|
||||
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
|
||||
#include "llvm/Transforms/Utils/SymbolRewriter.h"
|
||||
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
|
||||
#include "llvm/Transforms/Vectorize/LoopVectorize.h"
|
||||
#include "llvm/Transforms/Vectorize/SLPVectorizer.h"
|
||||
|
||||
|
@ -178,6 +178,7 @@ FUNCTION_PASS("lower-expect", LowerExpectIntrinsicPass())
|
||||
FUNCTION_PASS("lower-guard-intrinsic", LowerGuardIntrinsicPass())
|
||||
FUNCTION_PASS("guard-widening", GuardWideningPass())
|
||||
FUNCTION_PASS("gvn", GVN())
|
||||
FUNCTION_PASS("load-store-vectorizer", LoadStoreVectorizerPass())
|
||||
FUNCTION_PASS("loop-simplify", LoopSimplifyPass())
|
||||
FUNCTION_PASS("loop-sink", LoopSinkPass())
|
||||
FUNCTION_PASS("lowerinvoke", LowerInvokePass())
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include "llvm/Transforms/Vectorize.h"
|
||||
#include "llvm/Transforms/Vectorize/LoadStoreVectorizer.h"
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
@ -205,12 +206,12 @@ private:
|
||||
unsigned Alignment);
|
||||
};
|
||||
|
||||
class LoadStoreVectorizer : public FunctionPass {
|
||||
class LoadStoreVectorizerLegacyPass : public FunctionPass {
|
||||
public:
|
||||
static char ID;
|
||||
|
||||
LoadStoreVectorizer() : FunctionPass(ID) {
|
||||
initializeLoadStoreVectorizerPass(*PassRegistry::getPassRegistry());
|
||||
LoadStoreVectorizerLegacyPass() : FunctionPass(ID) {
|
||||
initializeLoadStoreVectorizerLegacyPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
@ -230,30 +231,23 @@ public:
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
char LoadStoreVectorizer::ID = 0;
|
||||
char LoadStoreVectorizerLegacyPass::ID = 0;
|
||||
|
||||
INITIALIZE_PASS_BEGIN(LoadStoreVectorizer, DEBUG_TYPE,
|
||||
INITIALIZE_PASS_BEGIN(LoadStoreVectorizerLegacyPass, DEBUG_TYPE,
|
||||
"Vectorize load and Store instructions", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(SCEVAAWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
|
||||
INITIALIZE_PASS_END(LoadStoreVectorizer, DEBUG_TYPE,
|
||||
INITIALIZE_PASS_END(LoadStoreVectorizerLegacyPass, DEBUG_TYPE,
|
||||
"Vectorize load and store instructions", false, false)
|
||||
|
||||
Pass *llvm::createLoadStoreVectorizerPass() {
|
||||
return new LoadStoreVectorizer();
|
||||
return new LoadStoreVectorizerLegacyPass();
|
||||
}
|
||||
|
||||
// The real propagateMetadata expects a SmallVector<Value*>, but we deal in
|
||||
// vectors of Instructions.
|
||||
static void propagateMetadata(Instruction *I, ArrayRef<Instruction *> IL) {
|
||||
SmallVector<Value *, 8> VL(IL.begin(), IL.end());
|
||||
propagateMetadata(I, VL);
|
||||
}
|
||||
|
||||
bool LoadStoreVectorizer::runOnFunction(Function &F) {
|
||||
bool LoadStoreVectorizerLegacyPass::runOnFunction(Function &F) {
|
||||
// Don't vectorize when the attribute NoImplicitFloat is used.
|
||||
if (skipFunction(F) || F.hasFnAttribute(Attribute::NoImplicitFloat))
|
||||
return false;
|
||||
@ -268,6 +262,30 @@ bool LoadStoreVectorizer::runOnFunction(Function &F) {
|
||||
return V.run();
|
||||
}
|
||||
|
||||
PreservedAnalyses LoadStoreVectorizerPass::run(Function &F, FunctionAnalysisManager &AM) {
|
||||
// Don't vectorize when the attribute NoImplicitFloat is used.
|
||||
if (F.hasFnAttribute(Attribute::NoImplicitFloat))
|
||||
return PreservedAnalyses::all();
|
||||
|
||||
AliasAnalysis &AA = AM.getResult<AAManager>(F);
|
||||
DominatorTree &DT = AM.getResult<DominatorTreeAnalysis>(F);
|
||||
ScalarEvolution &SE = AM.getResult<ScalarEvolutionAnalysis>(F);
|
||||
TargetTransformInfo &TTI = AM.getResult<TargetIRAnalysis>(F);
|
||||
|
||||
Vectorizer V(F, AA, DT, SE, TTI);
|
||||
bool Changed = V.run();
|
||||
PreservedAnalyses PA;
|
||||
PA.preserveSet<CFGAnalyses>();
|
||||
return Changed ? PA : PreservedAnalyses::all();
|
||||
}
|
||||
|
||||
// The real propagateMetadata expects a SmallVector<Value*>, but we deal in
|
||||
// vectors of Instructions.
|
||||
static void propagateMetadata(Instruction *I, ArrayRef<Instruction *> IL) {
|
||||
SmallVector<Value *, 8> VL(IL.begin(), IL.end());
|
||||
propagateMetadata(I, VL);
|
||||
}
|
||||
|
||||
// Vectorizer Implementation
|
||||
bool Vectorizer::run() {
|
||||
bool Changed = false;
|
||||
|
@ -27,7 +27,7 @@ using namespace llvm;
|
||||
void llvm::initializeVectorization(PassRegistry &Registry) {
|
||||
initializeLoopVectorizePass(Registry);
|
||||
initializeSLPVectorizerPass(Registry);
|
||||
initializeLoadStoreVectorizerPass(Registry);
|
||||
initializeLoadStoreVectorizerLegacyPassPass(Registry);
|
||||
}
|
||||
|
||||
void LLVMInitializeVectorization(LLVMPassRegistryRef R) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: opt -S -load-store-vectorizer -mattr=-unaligned-buffer-access,+max-private-element-size-16 < %s | FileCheck -check-prefix=ALIGNED -check-prefix=ALL %s
|
||||
; RUN: opt -S -load-store-vectorizer -mattr=+unaligned-buffer-access,+unaligned-scratch-access,+max-private-element-size-16 < %s | FileCheck -check-prefix=UNALIGNED -check-prefix=ALL %s
|
||||
; RUN: opt -S -passes='function(load-store-vectorizer)' -mattr=-unaligned-buffer-access,+max-private-element-size-16 < %s | FileCheck -check-prefix=ALIGNED -check-prefix=ALL %s
|
||||
; RUN: opt -S -passes='function(load-store-vectorizer)' -mattr=+unaligned-buffer-access,+unaligned-scratch-access,+max-private-element-size-16 < %s | FileCheck -check-prefix=UNALIGNED -check-prefix=ALL %s
|
||||
|
||||
target triple = "amdgcn--"
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
@ -48,4 +49,4 @@ entry:
|
||||
%cstoreval2 = fptrunc double %storeval2 to float
|
||||
store float %cstoreval2, float addrspace(1)* %arrayidx24, align 4
|
||||
ret void
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -S -mtriple=amdgcn--amdhsa -load-store-vectorizer < %s | FileCheck %s
|
||||
; RUN: opt -S -mtriple=amdgcn--amdhsa -passes='function(load-store-vectorizer)' < %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -basicaa -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=amdgcn-amd-amdhsa -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5"
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: opt -codegenprepare -load-store-vectorizer %s -S -o - | FileCheck %s
|
||||
; RUN: opt -load-store-vectorizer %s -S -o - | FileCheck %s
|
||||
; RUN: opt -codegenprepare -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' %s -S -o - | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' %s -S -o - | FileCheck %s
|
||||
|
||||
target triple = "x86_64--"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -load-store-vectorizer %s -S | FileCheck %s
|
||||
; RUN: opt -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' %s -S | FileCheck %s
|
||||
|
||||
; Check that setting wrapping flags after a SCEV node is created
|
||||
; does not invalidate "sorted by complexity" invariant for
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -mcpu haswell -S -o - %s | FileCheck --check-prefix=CHECK-HSW %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -mcpu knl -S -o - %s | FileCheck --check-prefix=CHECK-KNL %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -mcpu haswell -S -o - %s | FileCheck --check-prefix=CHECK-HSW %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -mcpu knl -S -o - %s | FileCheck --check-prefix=CHECK-KNL %s
|
||||
|
||||
define <8 x double> @loadwidth_insert_extract(double* %ptr) {
|
||||
%a = bitcast double* %ptr to <2 x double> *
|
||||
|
@ -1,5 +1,7 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -S < %s | \
|
||||
; RUN: FileCheck %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S < %s | \
|
||||
; RUN: FileCheck %s
|
||||
;
|
||||
; The GPU Load & Store Vectorizer may merge differently-typed accesses into a
|
||||
; single instruction. This test checks that we merge TBAA tags for such
|
||||
|
@ -1,5 +1,6 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt < %s -load-store-vectorizer -S -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
|
||||
; RUN: opt < %s -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
|
||||
|
||||
%rec = type { i32, i28 }
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=x86-linux -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=x86-linux -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:32:32-p1:64:64-p2:64:64-p3:32:32-p4:64:64-p5:32:32-p24:64:64-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -S -o - %s | FileCheck %s
|
||||
|
||||
target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -load-store-vectorizer -mcpu haswell -S -o - %s | FileCheck %s
|
||||
; RUN: opt -mtriple=x86_64-unknown-linux-gnu -aa-pipeline=basic-aa -passes='function(load-store-vectorizer)' -mcpu haswell -S -o - %s | FileCheck %s
|
||||
|
||||
; Check that the LoadStoreVectorizer does not crash due to not differentiating <1 x T> and T.
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
; RUN: opt -S < %s -load-store-vectorizer | FileCheck %s
|
||||
; RUN: opt -S < %s -passes='function(load-store-vectorizer)' | FileCheck %s
|
||||
|
||||
declare void @llvm.sideeffect()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user