[TargetTransformInfo] getIntrinsicInstrCost() scalarization estimation improved
getIntrinsicInstrCost() used to only compute scalarization cost based on types. This patch improves this so that the actual arguments are checked when they are available, in order to handle only unique non-constant operands. Tests updates: Analysis/CostModel/X86/arith-fp.ll Transforms/LoopVectorize/AArch64/interleaved_cost.ll Transforms/LoopVectorize/ARM/interleaved_cost.ll The improvement in getOperandsScalarizationOverhead() to differentiate on constants made it necessary to update the interleaved_cost.ll tests even though they do not relate to intrinsics. Review: Hal Finkel https://reviews.llvm.org/D29540 llvm-svn: 297705
This commit is contained in:
@@ -1877,12 +1877,9 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
|
||||
Intrinsic::ID ID = getVectorIntrinsicIDForCall(CI, TLI);
|
||||
|
||||
// Calculate the cost of the scalar and vector calls.
|
||||
SmallVector<Type*, 4> ScalarTys, VecTys;
|
||||
for (unsigned op = 0, opc = CI->getNumArgOperands(); op!= opc; ++op) {
|
||||
SmallVector<Type*, 4> ScalarTys;
|
||||
for (unsigned op = 0, opc = CI->getNumArgOperands(); op!= opc; ++op)
|
||||
ScalarTys.push_back(CI->getArgOperand(op)->getType());
|
||||
VecTys.push_back(VectorType::get(CI->getArgOperand(op)->getType(),
|
||||
VecTy->getNumElements()));
|
||||
}
|
||||
|
||||
FastMathFlags FMF;
|
||||
if (auto *FPMO = dyn_cast<FPMathOperator>(CI))
|
||||
@@ -1891,7 +1888,9 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
|
||||
int ScalarCallCost = VecTy->getNumElements() *
|
||||
TTI->getIntrinsicInstrCost(ID, ScalarTy, ScalarTys, FMF);
|
||||
|
||||
int VecCallCost = TTI->getIntrinsicInstrCost(ID, VecTy, VecTys, FMF);
|
||||
SmallVector<Value *, 4> Args(CI->arg_operands());
|
||||
int VecCallCost = TTI->getIntrinsicInstrCost(ID, CI->getType(), Args, FMF,
|
||||
VecTy->getNumElements());
|
||||
|
||||
DEBUG(dbgs() << "SLP: Call cost "<< VecCallCost - ScalarCallCost
|
||||
<< " (" << VecCallCost << "-" << ScalarCallCost << ")"
|
||||
|
||||
Reference in New Issue
Block a user