diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-06-19 09:16:06 +0000 | 
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2018-06-19 09:16:06 +0000 | 
| commit | c966f7213e65f0bcb17053086ad73336a67bcfae (patch) | |
| tree | 73ced035b7617805f51c0b639ef6381b33e1e995 /llvm/lib/Transforms/Vectorize | |
| parent | 2015a39955d7fe7ed1561b65b6a9d96bff6fc56c (diff) | |
| download | bcm5719-llvm-c966f7213e65f0bcb17053086ad73336a67bcfae.tar.gz bcm5719-llvm-c966f7213e65f0bcb17053086ad73336a67bcfae.zip | |
[SLPVectorizer] Pull out AltOpcode determination from reorderAltShuffleOperands.
Minor step towards making the alternate opcode system work with a wider range of opcode pairs.
llvm-svn: 335032
Diffstat (limited to 'llvm/lib/Transforms/Vectorize')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 14 | 
1 files changed, 8 insertions, 6 deletions
| diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 054c0a2c6fa..1e23e706c13 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -645,7 +645,8 @@ private:    /// \reorder commutative operands in alt shuffle if they result in    ///  vectorized code. -  void reorderAltShuffleOperands(unsigned Opcode, ArrayRef<Value *> VL, +  void reorderAltShuffleOperands(unsigned Opcode, unsigned AltOpcode, +                                 ArrayRef<Value *> VL,                                   SmallVectorImpl<Value *> &Left,                                   SmallVectorImpl<Value *> &Right); @@ -1917,7 +1918,8 @@ 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, VL, Left, Right); +        unsigned AltOpcode = getAltOpcode(S.Opcode); +        reorderAltShuffleOperands(S.Opcode, AltOpcode, VL, Left, Right);          buildTree_rec(Left, Depth + 1, UserTreeIdx);          buildTree_rec(Right, Depth + 1, UserTreeIdx);          return; @@ -2649,11 +2651,11 @@ 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, ArrayRef<Value *> VL, +void BoUpSLP::reorderAltShuffleOperands(unsigned Opcode, unsigned AltOpcode, +                                        ArrayRef<Value *> VL,                                          SmallVectorImpl<Value *> &Left,                                          SmallVectorImpl<Value *> &Right) {    // Push left and right operands of binary operation into Left and Right -  unsigned AltOpcode = getAltOpcode(Opcode);    (void)AltOpcode;    for (Value *V : VL) {      auto *I = cast<Instruction>(V); @@ -3492,7 +3494,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {        ValueList LHSVL, RHSVL;        assert(Instruction::isBinaryOp(S.Opcode) &&               "Invalid Shuffle Vector Operand"); -      reorderAltShuffleOperands(S.Opcode, E->Scalars, LHSVL, RHSVL); +      unsigned AltOpcode = getAltOpcode(S.Opcode); +      reorderAltShuffleOperands(S.Opcode, AltOpcode, E->Scalars, LHSVL, RHSVL);        setInsertPointAfterBundle(E->Scalars, VL0);        Value *LHS = vectorizeTree(LHSVL); @@ -3507,7 +3510,6 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {        Value *V0 = Builder.CreateBinOp(            static_cast<Instruction::BinaryOps>(S.Opcode), LHS, RHS); -      unsigned AltOpcode = getAltOpcode(S.Opcode);        // Create a vector of LHS op2 RHS        Value *V1 = Builder.CreateBinOp(            static_cast<Instruction::BinaryOps>(AltOpcode), LHS, RHS); | 

