@@ -6065,24 +6065,23 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
60656065 RetTy = IntegerType::get (RetTy->getContext (), MinBWs[I]);
60666066 auto *SE = PSE.getSE ();
60676067
6068- auto HasSingleCopyAfterVectorization = [this ](Instruction *I,
6069- ElementCount VF) -> bool {
6070- if (VF.isScalar ())
6071- return true ;
6072-
6073- auto Scalarized = InstsToScalarize.find (VF);
6074- assert (Scalarized != InstsToScalarize.end () &&
6075- " VF not yet analyzed for scalarization profitability" );
6076- return !Scalarized->second .count (I) &&
6077- llvm::all_of (I->users (), [&](User *U) {
6078- auto *UI = cast<Instruction>(U);
6079- return !Scalarized->second .count (UI);
6080- });
6081- };
6082- (void )HasSingleCopyAfterVectorization;
6083-
60846068 Type *VectorTy;
60856069 if (isScalarAfterVectorization (I, VF)) {
6070+ [[maybe_unused]] auto HasSingleCopyAfterVectorization =
6071+ [this ](Instruction *I, ElementCount VF) -> bool {
6072+ if (VF.isScalar ())
6073+ return true ;
6074+
6075+ auto Scalarized = InstsToScalarize.find (VF);
6076+ assert (Scalarized != InstsToScalarize.end () &&
6077+ " VF not yet analyzed for scalarization profitability" );
6078+ return !Scalarized->second .count (I) &&
6079+ llvm::all_of (I->users (), [&](User *U) {
6080+ auto *UI = cast<Instruction>(U);
6081+ return !Scalarized->second .count (UI);
6082+ });
6083+ };
6084+
60866085 // With the exception of GEPs and PHIs, after scalarization there should
60876086 // only be one copy of the instruction generated in the loop. This is
60886087 // because the VF is either 1, or any instructions that need scalarizing
@@ -6342,8 +6341,8 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
63426341 Type *ValTy = I->getOperand (0 )->getType ();
63436342
63446343 if (canTruncateToMinimalBitwidth (I, VF)) {
6345- Instruction *Op0AsInstruction = dyn_cast<Instruction>(I-> getOperand ( 0 ));
6346- ( void )Op0AsInstruction ;
6344+ [[maybe_unused]] Instruction *Op0AsInstruction =
6345+ dyn_cast<Instruction>(I-> getOperand ( 0 )) ;
63476346 assert ((!canTruncateToMinimalBitwidth (Op0AsInstruction, VF) ||
63486347 MinBWs[I] == MinBWs[Op0AsInstruction]) &&
63496348 " if both the operand and the compare are marked for "
@@ -7277,8 +7276,8 @@ static void fixReductionScalarResumeWhenVectorizingEpilog(
72777276 MainResumeValue = EpiRedHeaderPhi->getStartValue ()->getUnderlyingValue ();
72787277 if (RecurrenceDescriptor::isAnyOfRecurrenceKind (
72797278 RdxDesc.getRecurrenceKind ())) {
7280- Value *StartV = EpiRedResult-> getOperand ( 1 )-> getLiveInIRValue ();
7281- ( void )StartV ;
7279+ [[maybe_unused]] Value *StartV =
7280+ EpiRedResult-> getOperand ( 1 )-> getLiveInIRValue () ;
72827281 auto *Cmp = cast<ICmpInst>(MainResumeValue);
72837282 assert (Cmp->getPredicate () == CmpInst::ICMP_NE &&
72847283 " AnyOf expected to start with ICMP_NE" );
@@ -7292,15 +7291,14 @@ static void fixReductionScalarResumeWhenVectorizingEpilog(
72927291 Value *SentinelV = EpiRedResult->getOperand (2 )->getLiveInIRValue ();
72937292 using namespace llvm ::PatternMatch;
72947293 Value *Cmp, *OrigResumeV, *CmpOp;
7295- bool IsExpectedPattern =
7294+ [[maybe_unused]] bool IsExpectedPattern =
72967295 match (MainResumeValue,
72977296 m_Select (m_OneUse (m_Value (Cmp)), m_Specific (SentinelV),
72987297 m_Value (OrigResumeV))) &&
72997298 (match (Cmp, m_SpecificICmp (ICmpInst::ICMP_EQ, m_Specific (OrigResumeV),
73007299 m_Value (CmpOp))) &&
73017300 ((CmpOp == StartV && isGuaranteedNotToBeUndefOrPoison (CmpOp))));
73027301 assert (IsExpectedPattern && " Unexpected reduction resume pattern" );
7303- (void )IsExpectedPattern;
73047302 MainResumeValue = OrigResumeV;
73057303 }
73067304 PHINode *MainResumePhi = cast<PHINode>(MainResumeValue);
@@ -8255,10 +8253,10 @@ VPRecipeBase *VPRecipeBuilder::tryToCreateWidenRecipe(VPSingleDefRecipe *R,
82558253 SmallVector<VPValue *, 4 > Operands (R->operands ());
82568254 if (auto *PhiR = dyn_cast<VPWidenPHIRecipe>(R)) {
82578255 VPBasicBlock *Parent = PhiR->getParent ();
8258- VPRegionBlock *LoopRegionOf = Parent->getEnclosingLoopRegion ();
8256+ [[maybe_unused]] VPRegionBlock *LoopRegionOf =
8257+ Parent->getEnclosingLoopRegion ();
82598258 assert (LoopRegionOf && LoopRegionOf->getEntry () == Parent &&
82608259 " Non-header phis should have been handled during predication" );
8261- (void )LoopRegionOf;
82628260 auto *Phi = cast<PHINode>(R->getUnderlyingInstr ());
82638261 assert (Operands.size () == 2 && " Must have 2 operands for header phis" );
82648262 if ((Recipe = tryToOptimizeInductionPHI (Phi, Operands, Range)))
0 commit comments