[llvm-branch-commits] [llvm] 3bf7d47 - [NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp

David Sherwood via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Dec 21 01:17:25 PST 2020


Author: David Sherwood
Date: 2020-12-21T09:12:28Z
New Revision: 3bf7d47a977d463940f558259d24d43d76d50e6f

URL: https://github.com/llvm/llvm-project/commit/3bf7d47a977d463940f558259d24d43d76d50e6f
DIFF: https://github.com/llvm/llvm-project/commit/3bf7d47a977d463940f558259d24d43d76d50e6f.diff

LOG: [NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp

An earlier patch introduced asserts that the InstructionCost is
valid because at that time the ReuseShuffleCost variable was an
unsigned. However, now that the variable is an InstructionCost
instance the asserts can be removed.

See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

See this patch for the introduction of the type:
https://reviews.llvm.org/D91174

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 80d510185470..b03fb203c6d7 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3806,23 +3806,17 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) {
       if (NeedToShuffleReuses) {
         for (unsigned Idx : E->ReuseShuffleIndices) {
           Instruction *I = cast<Instruction>(VL[Idx]);
-          InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
-          assert(Cost.isValid() && "Invalid instruction cost");
-          ReuseShuffleCost -= *(Cost.getValue());
+          ReuseShuffleCost -= TTI->getInstructionCost(I, CostKind);
         }
         for (Value *V : VL) {
           Instruction *I = cast<Instruction>(V);
-          InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
-          assert(Cost.isValid() && "Invalid instruction cost");
-          ReuseShuffleCost += *(Cost.getValue());
+          ReuseShuffleCost += TTI->getInstructionCost(I, CostKind);
         }
       }
       for (Value *V : VL) {
         Instruction *I = cast<Instruction>(V);
         assert(E->isOpcodeOrAlt(I) && "Unexpected main/alternate opcode");
-        InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
-        assert(Cost.isValid() && "Invalid instruction cost");
-        ScalarCost += *(Cost.getValue());
+        ScalarCost += TTI->getInstructionCost(I, CostKind);
       }
       // VecCost is equal to sum of the cost of creating 2 vectors
       // and the cost of creating shuffle.


        


More information about the llvm-branch-commits mailing list