diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-06-22 16:10:26 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-06-22 16:10:26 +0000 |
commit | 213cb1b82d3c8e311a4ea45d8c0888b9eb0008da (patch) | |
tree | 47d266c8d437df9de39623167aae2868d8772723 /llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | |
parent | bf549bf40231495888ce44e6b15e4eaf3a817971 (diff) | |
download | bcm5719-llvm-213cb1b82d3c8e311a4ea45d8c0888b9eb0008da.tar.gz bcm5719-llvm-213cb1b82d3c8e311a4ea45d8c0888b9eb0008da.zip |
[SLPVectorizer] reorderAltShuffleOperands should just take InstructionsState. NFCI.
All calls were extracting the InstructionsState Opcode/AltOpcode values so we might as well pass it directly
llvm-svn: 335359
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index a4d36e256e8..a65af3335b2 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -624,7 +624,7 @@ private: /// \reorder commutative operands in alt shuffle if they result in /// vectorized code. - void reorderAltShuffleOperands(unsigned Opcode, unsigned AltOpcode, + void reorderAltShuffleOperands(const InstructionsState &S, ArrayRef<Value *> VL, SmallVectorImpl<Value *> &Left, SmallVectorImpl<Value *> &Right); @@ -1898,7 +1898,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth, // Reorder operands if reordering would enable vectorization. if (isa<BinaryOperator>(VL0)) { ValueList Left, Right; - reorderAltShuffleOperands(S.Opcode, S.AltOpcode, VL, Left, Right); + reorderAltShuffleOperands(S, VL, Left, Right); buildTree_rec(Left, Depth + 1, UserTreeIdx); buildTree_rec(Right, Depth + 1, UserTreeIdx); return; @@ -2623,15 +2623,14 @@ int BoUpSLP::getGatherCost(ArrayRef<Value *> VL) { // load a[3] + load b[3] // Reordering the second load b[1] load a[1] would allow us to vectorize this // code. -void BoUpSLP::reorderAltShuffleOperands(unsigned Opcode, unsigned AltOpcode, +void BoUpSLP::reorderAltShuffleOperands(const InstructionsState &S, ArrayRef<Value *> VL, SmallVectorImpl<Value *> &Left, SmallVectorImpl<Value *> &Right) { // Push left and right operands of binary operation into Left and Right - (void)AltOpcode; for (Value *V : VL) { auto *I = cast<Instruction>(V); - assert(sameOpcodeOrAlt(Opcode, AltOpcode, I->getOpcode()) && + assert(sameOpcodeOrAlt(S.Opcode, S.AltOpcode, I->getOpcode()) && "Incorrect instruction in vector"); Left.push_back(I->getOperand(0)); Right.push_back(I->getOperand(1)); @@ -3469,8 +3468,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) { ValueList LHSVL, RHSVL; assert(Instruction::isBinaryOp(S.Opcode) && "Invalid Shuffle Vector Operand"); - reorderAltShuffleOperands(S.Opcode, S.AltOpcode, E->Scalars, LHSVL, - RHSVL); + reorderAltShuffleOperands(S, E->Scalars, LHSVL, RHSVL); setInsertPointAfterBundle(E->Scalars, S); Value *LHS = vectorizeTree(LHSVL); |