From da2cdfd4211af29550cdd7733c6741c297c13a4e Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Thu, 22 Apr 2021 07:49:08 -0700 Subject: [PATCH] [SLP]Added explicit ref to TargetTransformInfo to try to pacify MSVC buildbots, NFC. --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index d8e9840d..6c35f04 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -3543,8 +3543,10 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { TTI->getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, VecTy, E->ReuseShuffleIndices); } - auto &&AdjustExtractsCost = [this, CostKind, VL, VecTy](InstructionCost &Cost, - bool IsGather) { + // FIXME: it tries to fix a problem with MSVC buildbots. + TargetTransformInfo &TTIRef = *TTI; + auto &&AdjustExtractsCost = [this, &TTIRef, CostKind, VL, + VecTy](InstructionCost &Cost, bool IsGather) { DenseMap ExtractVectorsTys; for (auto *V : VL) { // If all users of instruction are going to be vectorized and this @@ -3556,8 +3558,8 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { continue; auto *EE = cast(V); unsigned Idx = *getExtractIndex(EE); - if (TTI->getNumberOfParts(VecTy) != - TTI->getNumberOfParts(EE->getVectorOperandType())) { + if (TTIRef.getNumberOfParts(VecTy) != + TTIRef.getNumberOfParts(EE->getVectorOperandType())) { auto It = ExtractVectorsTys.try_emplace(EE->getVectorOperand(), Idx).first; It->getSecond() = std::min(It->second, Idx); @@ -3571,17 +3573,17 @@ InstructionCost BoUpSLP::getEntryCost(TreeEntry *E) { // Use getExtractWithExtendCost() to calculate the cost of // extractelement/ext pair. Cost -= - TTI->getExtractWithExtendCost(Ext->getOpcode(), Ext->getType(), - EE->getVectorOperandType(), Idx); + TTIRef.getExtractWithExtendCost(Ext->getOpcode(), Ext->getType(), + EE->getVectorOperandType(), Idx); // Add back the cost of s|zext which is subtracted separately. - Cost += TTI->getCastInstrCost( + Cost += TTIRef.getCastInstrCost( Ext->getOpcode(), Ext->getType(), EE->getType(), TTI::getCastContextHint(Ext), CostKind, Ext); continue; } } - Cost -= TTI->getVectorInstrCost(Instruction::ExtractElement, - EE->getVectorOperandType(), Idx); + Cost -= TTIRef.getVectorInstrCost(Instruction::ExtractElement, + EE->getVectorOperandType(), Idx); } // Add a cost for subvector extracts/inserts if required. for (const auto &Data : ExtractVectorsTys) { -- 2.7.4