Skip to content

Commit c8d7a73

Browse files
authored
[LV] Improve code around operands-iterator (NFC) (#156016)
1 parent 9ad8e12 commit c8d7a73

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6198,10 +6198,9 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
61986198
assert(Op0->getType()->getScalarSizeInBits() == 1 &&
61996199
Op1->getType()->getScalarSizeInBits() == 1);
62006200

6201-
SmallVector<const Value *, 2> Operands{Op0, Op1};
62026201
return TTI.getArithmeticInstrCost(
6203-
match(I, m_LogicalOr()) ? Instruction::Or : Instruction::And, VectorTy,
6204-
CostKind, {Op1VK, Op1VP}, {Op2VK, Op2VP}, Operands, I);
6202+
match(I, m_LogicalOr()) ? Instruction::Or : Instruction::And,
6203+
VectorTy, CostKind, {Op1VK, Op1VP}, {Op2VK, Op2VP}, {Op0, Op1}, I);
62056204
}
62066205

62076206
Type *CondTy = SI->getCondition()->getType();
@@ -6431,7 +6430,7 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
64316430
}))
64326431
continue;
64336432
VecValuesToIgnore.insert(Op);
6434-
DeadInterleavePointerOps.append(Op->op_begin(), Op->op_end());
6433+
append_range(DeadInterleavePointerOps, Op->operands());
64356434
}
64366435

64376436
for (const auto &[_, Ops] : DeadInvariantStoreOps)
@@ -6491,7 +6490,7 @@ void LoopVectorizationCostModel::collectValuesToIgnore() {
64916490
ValuesToIgnore.insert(Op);
64926491

64936492
VecValuesToIgnore.insert(Op);
6494-
DeadOps.append(Op->op_begin(), Op->op_end());
6493+
append_range(DeadOps, Op->operands());
64956494
}
64966495

64976496
// Ignore type-promoting instructions we identified during reduction
@@ -8691,10 +8690,8 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(
86918690

86928691
VPRecipeBase *Recipe =
86938692
RecipeBuilder.tryToCreateWidenRecipe(SingleDef, Range);
8694-
if (!Recipe) {
8695-
SmallVector<VPValue *, 4> Operands(R.operands());
8696-
Recipe = RecipeBuilder.handleReplication(Instr, Operands, Range);
8697-
}
8693+
if (!Recipe)
8694+
Recipe = RecipeBuilder.handleReplication(Instr, R.operands(), Range);
86988695

86998696
RecipeBuilder.setRecipe(Instr, Recipe);
87008697
if (isa<VPWidenIntOrFpInductionRecipe>(Recipe) && isa<TruncInst>(Instr)) {

0 commit comments

Comments
 (0)