[llvm] r336102 - [SLPVectorizer] Remove nullptr early-outs from Instruction::ShuffleVector getEntryCost

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 06:41:29 PDT 2018


Author: rksimon
Date: Mon Jul  2 06:41:29 2018
New Revision: 336102

URL: http://llvm.org/viewvc/llvm-project?rev=336102&view=rev
Log:
[SLPVectorizer] Remove nullptr early-outs from Instruction::ShuffleVector getEntryCost

This code is only used by alternate opcodes so the InstructionsState has already confirmed that every Value is an Instruction, plus we use cast<Instruction> which will assert on failure.

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=336102&r1=336101&r2=336102&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Mon Jul  2 06:41:29 2018
@@ -2357,15 +2357,11 @@ int BoUpSLP::getEntryCost(TreeEntry *E)
       if (NeedToShuffleReuses) {
         for (unsigned Idx : E->ReuseShuffleIndices) {
           Instruction *I = cast<Instruction>(VL[Idx]);
-          if (!I)
-            continue;
           ReuseShuffleCost -=
               TTI->getArithmeticInstrCost(I->getOpcode(), ScalarTy);
         }
         for (Value *V : VL) {
           Instruction *I = cast<Instruction>(V);
-          if (!I)
-            continue;
           ReuseShuffleCost +=
               TTI->getArithmeticInstrCost(I->getOpcode(), ScalarTy);
         }
@@ -2373,8 +2369,6 @@ int BoUpSLP::getEntryCost(TreeEntry *E)
       int VecCost = 0;
       for (Value *i : VL) {
         Instruction *I = cast<Instruction>(i);
-        if (!I)
-          break;
         assert(S.isOpcodeOrAlt(I) && "Unexpected main/alternate opcode");
         ScalarCost += TTI->getArithmeticInstrCost(I->getOpcode(), ScalarTy);
       }




More information about the llvm-commits mailing list