mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 06:44:46 +01:00
[SVE] Eliminate calls to default-false VectorType::get() from Vectorize
Reviewers: efriedma, fhahn, spatel, sdesmalen, kmclaughlin Reviewed By: efriedma Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81521
This commit is contained in:
@@ -6236,8 +6236,8 @@ unsigned LoopVectorizationCostModel::getInstructionCost(Instruction *I,
|
||||
|
||||
if (ScalarPredicatedBB) {
|
||||
// Return cost for branches around scalarized and predicated blocks.
|
||||
VectorType *Vec_i1Ty =
|
||||
VectorType::get(IntegerType::getInt1Ty(RetTy->getContext()), VF);
|
||||
auto *Vec_i1Ty =
|
||||
FixedVectorType::get(IntegerType::getInt1Ty(RetTy->getContext()), VF);
|
||||
return (TTI.getScalarizationOverhead(Vec_i1Ty, APInt::getAllOnesValue(VF),
|
||||
false, true) +
|
||||
(TTI.getCFInstrCost(Instruction::Br, CostKind) * VF));
|
||||
@@ -6259,7 +6259,7 @@ unsigned LoopVectorizationCostModel::getInstructionCost(Instruction *I,
|
||||
if (VF > 1 && Legal->isFirstOrderRecurrence(Phi))
|
||||
return TTI.getShuffleCost(TargetTransformInfo::SK_ExtractSubvector,
|
||||
cast<VectorType>(VectorTy), VF - 1,
|
||||
VectorType::get(RetTy, 1));
|
||||
FixedVectorType::get(RetTy, 1));
|
||||
|
||||
// Phi nodes in non-header blocks (not inductions, reductions, etc.) are
|
||||
// converted into select instructions. We require N - 1 selects per phi
|
||||
|
||||
@@ -3283,13 +3283,13 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
|
||||
ScalarTy = SI->getValueOperand()->getType();
|
||||
else if (CmpInst *CI = dyn_cast<CmpInst>(VL[0]))
|
||||
ScalarTy = CI->getOperand(0)->getType();
|
||||
VectorType *VecTy = VectorType::get(ScalarTy, VL.size());
|
||||
auto *VecTy = FixedVectorType::get(ScalarTy, VL.size());
|
||||
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput;
|
||||
|
||||
// If we have computed a smaller type for the expression, update VecTy so
|
||||
// that the costs will be accurate.
|
||||
if (MinBWs.count(VL[0]))
|
||||
VecTy = VectorType::get(
|
||||
VecTy = FixedVectorType::get(
|
||||
IntegerType::get(F->getContext(), MinBWs[VL[0]].first), VL.size());
|
||||
|
||||
unsigned ReuseShuffleNumbers = E->ReuseShuffleIndices.size();
|
||||
@@ -3872,13 +3872,13 @@ int BoUpSLP::getTreeCost() {
|
||||
// If we plan to rewrite the tree in a smaller type, we will need to sign
|
||||
// extend the extracted value back to the original type. Here, we account
|
||||
// for the extract and the added cost of the sign extend if needed.
|
||||
auto *VecTy = VectorType::get(EU.Scalar->getType(), BundleWidth);
|
||||
auto *VecTy = FixedVectorType::get(EU.Scalar->getType(), BundleWidth);
|
||||
auto *ScalarRoot = VectorizableTree[0]->Scalars[0];
|
||||
if (MinBWs.count(ScalarRoot)) {
|
||||
auto *MinTy = IntegerType::get(F->getContext(), MinBWs[ScalarRoot].first);
|
||||
auto Extend =
|
||||
MinBWs[ScalarRoot].second ? Instruction::SExt : Instruction::ZExt;
|
||||
VecTy = VectorType::get(MinTy, BundleWidth);
|
||||
VecTy = FixedVectorType::get(MinTy, BundleWidth);
|
||||
ExtractCost += TTI->getExtractWithExtendCost(Extend, EU.Scalar->getType(),
|
||||
VecTy, EU.Lane);
|
||||
} else {
|
||||
@@ -3924,7 +3924,7 @@ int BoUpSLP::getGatherCost(ArrayRef<Value *> VL) const {
|
||||
Type *ScalarTy = VL[0]->getType();
|
||||
if (StoreInst *SI = dyn_cast<StoreInst>(VL[0]))
|
||||
ScalarTy = SI->getValueOperand()->getType();
|
||||
VectorType *VecTy = VectorType::get(ScalarTy, VL.size());
|
||||
auto *VecTy = FixedVectorType::get(ScalarTy, VL.size());
|
||||
// Find the cost of inserting/extracting values from the vector.
|
||||
// Check if the same elements are inserted several times and count them as
|
||||
// shuffle candidates.
|
||||
@@ -6978,7 +6978,7 @@ private:
|
||||
int getReductionCost(TargetTransformInfo *TTI, Value *FirstReducedVal,
|
||||
unsigned ReduxWidth) {
|
||||
Type *ScalarTy = FirstReducedVal->getType();
|
||||
VectorType *VecTy = VectorType::get(ScalarTy, ReduxWidth);
|
||||
auto *VecTy = FixedVectorType::get(ScalarTy, ReduxWidth);
|
||||
|
||||
int PairwiseRdxCost;
|
||||
int SplittingRdxCost;
|
||||
|
||||
Reference in New Issue
Block a user