diff options
author | Hongbin Zheng <etherzhhb@gmail.com> | 2012-04-05 08:05:16 +0000 |
---|---|---|
committer | Hongbin Zheng <etherzhhb@gmail.com> | 2012-04-05 08:05:16 +0000 |
commit | 87825e7970a361ce5a8bab19bc880ff7f6242ca2 (patch) | |
tree | fe5a25882cc55db34c924fabfc3b6722c3d13cf4 /lib | |
parent | 22378fd664fed97c296878d8d188ab06e2c89395 (diff) | |
download | external_llvm-87825e7970a361ce5a8bab19bc880ff7f6242ca2.zip external_llvm-87825e7970a361ce5a8bab19bc880ff7f6242ca2.tar.gz external_llvm-87825e7970a361ce5a8bab19bc880ff7f6242ca2.tar.bz2 |
Add the function "vectorizeBasicBlock" which allow users vectorize a
BasicBlock in other passes, e.g. we can call vectorizeBasicBlock in the
loop unroll pass right after the loop is unrolled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154089 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Vectorize/BBVectorize.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/Transforms/Vectorize/BBVectorize.cpp b/lib/Transforms/Vectorize/BBVectorize.cpp index 28eb634..5abb242 100644 --- a/lib/Transforms/Vectorize/BBVectorize.cpp +++ b/lib/Transforms/Vectorize/BBVectorize.cpp @@ -144,6 +144,12 @@ namespace { initializeBBVectorizePass(*PassRegistry::getPassRegistry()); } + BBVectorize(Pass *P) : BasicBlockPass(ID) { + AA = &P->getAnalysis<AliasAnalysis>(); + SE = &P->getAnalysis<ScalarEvolution>(); + TD = P->getAnalysisIfAvailable<TargetData>(); + } + typedef std::pair<Value *, Value *> ValuePair; typedef std::pair<ValuePair, size_t> ValuePairWithDepth; typedef std::pair<ValuePair, ValuePair> VPPair; // A ValuePair pair @@ -280,11 +286,7 @@ namespace { Instruction *&InsertionPt, Instruction *I, Instruction *J); - virtual bool runOnBasicBlock(BasicBlock &BB) { - AA = &getAnalysis<AliasAnalysis>(); - SE = &getAnalysis<ScalarEvolution>(); - TD = getAnalysisIfAvailable<TargetData>(); - + bool vectorizeBB(BasicBlock &BB) { bool changed = false; // Iterate a sufficient number of times to merge types of size 1 bit, // then 2 bits, then 4, etc. up to half of the target vector width of the @@ -304,6 +306,14 @@ namespace { return changed; } + virtual bool runOnBasicBlock(BasicBlock &BB) { + AA = &getAnalysis<AliasAnalysis>(); + SE = &getAnalysis<ScalarEvolution>(); + TD = getAnalysisIfAvailable<TargetData>(); + + return vectorizeBB(BB); + } + virtual void getAnalysisUsage(AnalysisUsage &AU) const { BasicBlockPass::getAnalysisUsage(AU); AU.addRequired<AliasAnalysis>(); @@ -1861,3 +1871,7 @@ BasicBlockPass *llvm::createBBVectorizePass() { return new BBVectorize(); } +bool llvm::vectorizeBasicBlock(Pass *P, BasicBlock &BB) { + BBVectorize BBVectorizer(P); + return BBVectorizer.vectorizeBB(BB); +} |