[llvm] r336092 - [SLPVectorizer] Only Alternate opcodes use ShuffleVector cases for getEntryCost/vectorizeTree. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 03:54:19 PDT 2018


Author: rksimon
Date: Mon Jul  2 03:54:19 2018
New Revision: 336092

URL: http://llvm.org/viewvc/llvm-project?rev=336092&view=rev
Log:
[SLPVectorizer] Only Alternate opcodes use ShuffleVector cases for getEntryCost/vectorizeTree. NFCI.

Add assertions - we're already assuming this in how we use the AltOpcode and treat everything as BinaryOperators.

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=336092&r1=336091&r2=336092&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Mon Jul  2 03:54:19 2018
@@ -2350,6 +2350,9 @@ int BoUpSLP::getEntryCost(TreeEntry *E)
       return ReuseShuffleCost + VecCallCost - ScalarCallCost;
     }
     case Instruction::ShuffleVector: {
+      assert(S.isAltShuffle() && Instruction::isBinaryOp(S.Opcode) &&
+             Instruction::isBinaryOp(S.AltOpcode) &&
+             "Invalid Shuffle Vector Operand");
       int ScalarCost = 0;
       if (NeedToShuffleReuses) {
         for (unsigned Idx : E->ReuseShuffleIndices) {
@@ -3461,7 +3464,8 @@ Value *BoUpSLP::vectorizeTree(TreeEntry
     }
     case Instruction::ShuffleVector: {
       ValueList LHSVL, RHSVL;
-      assert(Instruction::isBinaryOp(S.Opcode) &&
+      assert(S.isAltShuffle() && Instruction::isBinaryOp(S.Opcode) &&
+             Instruction::isBinaryOp(S.AltOpcode) &&
              "Invalid Shuffle Vector Operand");
       reorderAltShuffleOperands(S, E->Scalars, LHSVL, RHSVL);
       setInsertPointAfterBundle(E->Scalars, S);




More information about the llvm-commits mailing list