Skip to content

Commit 3bf7d47

Browse files
committed
[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
1 parent f6c7ebe commit 3bf7d47

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,23 +3806,17 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) {
38063806
if (NeedToShuffleReuses) {
38073807
for (unsigned Idx : E->ReuseShuffleIndices) {
38083808
Instruction *I = cast<Instruction>(VL[Idx]);
3809-
InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
3810-
assert(Cost.isValid() && "Invalid instruction cost");
3811-
ReuseShuffleCost -= *(Cost.getValue());
3809+
ReuseShuffleCost -= TTI->getInstructionCost(I, CostKind);
38123810
}
38133811
for (Value *V : VL) {
38143812
Instruction *I = cast<Instruction>(V);
3815-
InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
3816-
assert(Cost.isValid() && "Invalid instruction cost");
3817-
ReuseShuffleCost += *(Cost.getValue());
3813+
ReuseShuffleCost += TTI->getInstructionCost(I, CostKind);
38183814
}
38193815
}
38203816
for (Value *V : VL) {
38213817
Instruction *I = cast<Instruction>(V);
38223818
assert(E->isOpcodeOrAlt(I) && "Unexpected main/alternate opcode");
3823-
InstructionCost Cost = TTI->getInstructionCost(I, CostKind);
3824-
assert(Cost.isValid() && "Invalid instruction cost");
3825-
ScalarCost += *(Cost.getValue());
3819+
ScalarCost += TTI->getInstructionCost(I, CostKind);
38263820
}
38273821
// VecCost is equal to sum of the cost of creating 2 vectors
38283822
// and the cost of creating shuffle.

0 commit comments

Comments
 (0)