diff options
author | Galina Kistanova <gkistanova@gmail.com> | 2018-05-18 18:14:06 +0000 |
---|---|---|
committer | Galina Kistanova <gkistanova@gmail.com> | 2018-05-18 18:14:06 +0000 |
commit | 083ea389d673e4dcfa3bee476598440f07d66ce6 (patch) | |
tree | d55b7f1b2fe401f52073ed5b062c55b83c104efe /llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | |
parent | 0edca4f5059b817092435ab4d84705981399a07e (diff) | |
download | bcm5719-llvm-083ea389d673e4dcfa3bee476598440f07d66ce6.tar.gz bcm5719-llvm-083ea389d673e4dcfa3bee476598440f07d66ce6.zip |
Reverted r332654 as it has broken some buildbots and left unfixed for a long time.
The introduced problem is:
llvm.src/lib/Transforms/Vectorize/VPlanVerifier.cpp:29:13: error: unused function 'hasDuplicates' [-Werror,-Wunused-function]
static bool hasDuplicates(const SmallVectorImpl<VPBlockBase *> &VPBlockVec) {
^
llvm-svn: 332747
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | 101 |
1 files changed, 5 insertions, 96 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h index 70629cb35d2..304bc7ab57b 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -39,94 +39,23 @@ private: VPBasicBlock::iterator InsertPt = VPBasicBlock::iterator(); VPInstruction *createInstruction(unsigned Opcode, - ArrayRef<VPValue *> Operands) { + std::initializer_list<VPValue *> Operands) { VPInstruction *Instr = new VPInstruction(Opcode, Operands); - if (BB) - BB->insert(Instr, InsertPt); + BB->insert(Instr, InsertPt); return Instr; } - VPInstruction *createInstruction(unsigned Opcode, - std::initializer_list<VPValue *> Operands) { - return createInstruction(Opcode, ArrayRef<VPValue *>(Operands)); - } - public: VPBuilder() {} - /// Clear the insertion point: created instructions will not be inserted into - /// a block. - void clearInsertionPoint() { - BB = nullptr; - InsertPt = VPBasicBlock::iterator(); - } - - VPBasicBlock *getInsertBlock() const { return BB; } - VPBasicBlock::iterator getInsertPoint() const { return InsertPt; } - - /// InsertPoint - A saved insertion point. - class VPInsertPoint { - VPBasicBlock *Block = nullptr; - VPBasicBlock::iterator Point; - - public: - /// Creates a new insertion point which doesn't point to anything. - VPInsertPoint() = default; - - /// Creates a new insertion point at the given location. - VPInsertPoint(VPBasicBlock *InsertBlock, VPBasicBlock::iterator InsertPoint) - : Block(InsertBlock), Point(InsertPoint) {} - - /// Returns true if this insert point is set. - bool isSet() const { return Block != nullptr; } - - VPBasicBlock *getBlock() const { return Block; } - VPBasicBlock::iterator getPoint() const { return Point; } - }; - - /// Sets the current insert point to a previously-saved location. - void restoreIP(VPInsertPoint IP) { - if (IP.isSet()) - setInsertPoint(IP.getBlock(), IP.getPoint()); - else - clearInsertionPoint(); - } - - /// This specifies that created VPInstructions should be appended to the end - /// of the specified block. + /// This specifies that created VPInstructions should be appended to + /// the end of the specified block. void setInsertPoint(VPBasicBlock *TheBB) { assert(TheBB && "Attempting to set a null insert point"); BB = TheBB; InsertPt = BB->end(); } - /// This specifies that created instructions should be inserted at the - /// specified point. - void setInsertPoint(VPBasicBlock *TheBB, VPBasicBlock::iterator IP) { - BB = TheBB; - InsertPt = IP; - } - - /// Insert and return the specified instruction. - VPInstruction *insert(VPInstruction *I) const { - BB->insert(I, InsertPt); - return I; - } - - /// Create an N-ary operation with \p Opcode, \p Operands and set \p Inst as - /// its underlying Instruction. - VPValue *createNaryOp(unsigned Opcode, ArrayRef<VPValue *> Operands, - Instruction *Inst = nullptr) { - VPInstruction *NewVPInst = createInstruction(Opcode, Operands); - NewVPInst->setUnderlyingValue(Inst); - return NewVPInst; - } - VPValue *createNaryOp(unsigned Opcode, - std::initializer_list<VPValue *> Operands, - Instruction *Inst = nullptr) { - return createNaryOp(Opcode, ArrayRef<VPValue *>(Operands), Inst); - } - VPValue *createNot(VPValue *Operand) { return createInstruction(VPInstruction::Not, {Operand}); } @@ -138,29 +67,9 @@ public: VPValue *createOr(VPValue *LHS, VPValue *RHS) { return createInstruction(Instruction::BinaryOps::Or, {LHS, RHS}); } - - //===--------------------------------------------------------------------===// - // RAII helpers. - //===--------------------------------------------------------------------===// - - /// RAII object that stores the current insertion point and restores it when - /// the object is destroyed. - class InsertPointGuard { - VPBuilder &Builder; - VPBasicBlock *Block; - VPBasicBlock::iterator Point; - - public: - InsertPointGuard(VPBuilder &B) - : Builder(B), Block(B.getInsertBlock()), Point(B.getInsertPoint()) {} - - InsertPointGuard(const InsertPointGuard &) = delete; - InsertPointGuard &operator=(const InsertPointGuard &) = delete; - - ~InsertPointGuard() { Builder.restoreIP(VPInsertPoint(Block, Point)); } - }; }; + /// TODO: The following VectorizationFactor was pulled out of /// LoopVectorizationCostModel class. LV also deals with /// VectorizerParams::VectorizationFactor and VectorizationCostTy. |