@@ -2436,8 +2436,7 @@ class BoUpSLP {
2436
2436
2437
2437
/// Return information about the vector formed for the specified index
2438
2438
/// of a vector of (the same) instruction.
2439
- TargetTransformInfo::OperandValueInfo getOperandInfo(const TreeEntry &E,
2440
- unsigned OpIdx);
2439
+ TargetTransformInfo::OperandValueInfo getOperandInfo(ArrayRef<Value *> Ops);
2441
2440
2442
2441
/// \returns the cost of the vectorizable entry.
2443
2442
InstructionCost getEntryCost(const TreeEntry *E,
@@ -6559,27 +6558,25 @@ static bool isAlternateInstruction(const Instruction *I,
6559
6558
return I->getOpcode() == AltOp->getOpcode();
6560
6559
}
6561
6560
6562
- TTI::OperandValueInfo BoUpSLP::getOperandInfo(const TreeEntry &E,
6563
- unsigned OpIdx) {
6564
- ArrayRef<Value*> VL = E.getOperand(OpIdx);
6565
- assert(!VL.empty());
6566
- const auto *Op0 = VL.front();
6561
+ TTI::OperandValueInfo BoUpSLP::getOperandInfo(ArrayRef<Value *> Ops) {
6562
+ assert(!Ops.empty());
6563
+ const auto *Op0 = Ops.front();
6567
6564
6568
- const bool IsConstant = all_of(VL , [](Value *V) {
6565
+ const bool IsConstant = all_of(Ops , [](Value *V) {
6569
6566
// TODO: We should allow undef elements here
6570
6567
return isConstant(V) && !isa<UndefValue>(V);
6571
6568
});
6572
- const bool IsUniform = all_of(VL , [=](Value *V) {
6569
+ const bool IsUniform = all_of(Ops , [=](Value *V) {
6573
6570
// TODO: We should allow undef elements here
6574
6571
return V == Op0;
6575
6572
});
6576
- const bool IsPowerOfTwo = all_of(VL , [](Value *V) {
6573
+ const bool IsPowerOfTwo = all_of(Ops , [](Value *V) {
6577
6574
// TODO: We should allow undef elements here
6578
6575
if (auto *CI = dyn_cast<ConstantInt>(V))
6579
6576
return CI->getValue().isPowerOf2();
6580
6577
return false;
6581
6578
});
6582
- const bool IsNegatedPowerOfTwo = all_of(VL , [](Value *V) {
6579
+ const bool IsNegatedPowerOfTwo = all_of(Ops , [](Value *V) {
6583
6580
// TODO: We should allow undef elements here
6584
6581
if (auto *CI = dyn_cast<ConstantInt>(V))
6585
6582
return CI->getValue().isNegatedPowerOf2();
@@ -7999,8 +7996,8 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
7999
7996
};
8000
7997
auto GetVectorCost = [=](InstructionCost CommonCost) {
8001
7998
unsigned OpIdx = isa<UnaryOperator>(VL0) ? 0 : 1;
8002
- TTI::OperandValueInfo Op1Info = getOperandInfo(*E, 0 );
8003
- TTI::OperandValueInfo Op2Info = getOperandInfo(*E, OpIdx);
7999
+ TTI::OperandValueInfo Op1Info = getOperandInfo(E->getOperand(0) );
8000
+ TTI::OperandValueInfo Op2Info = getOperandInfo(E->getOperand( OpIdx) );
8004
8001
return TTI->getArithmeticInstrCost(ShuffleOrOp, VecTy, CostKind, Op1Info,
8005
8002
Op2Info) +
8006
8003
CommonCost;
@@ -8065,7 +8062,7 @@ BoUpSLP::getEntryCost(const TreeEntry *E, ArrayRef<Value *> VectorizedVals,
8065
8062
cast<StoreInst>(IsReorder ? VL[E->ReorderIndices.front()] : VL0);
8066
8063
auto GetVectorCost = [=](InstructionCost CommonCost) {
8067
8064
// We know that we can merge the stores. Calculate the cost.
8068
- TTI::OperandValueInfo OpInfo = getOperandInfo(*E, 0 );
8065
+ TTI::OperandValueInfo OpInfo = getOperandInfo(E->getOperand(0) );
8069
8066
return TTI->getMemoryOpCost(Instruction::Store, VecTy, BaseSI->getAlign(),
8070
8067
BaseSI->getPointerAddressSpace(), CostKind,
8071
8068
OpInfo) +
0 commit comments