diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -520,7 +520,7 @@ /// Instr's operands. void scalarizeInstruction(const Instruction *Instr, VPReplicateRecipe *RepRecipe, - const VPIteration &Instance, bool IfPredicateInstr, + const VPIteration &Instance, VPTransformState &State); /// Construct the vector value of a scalarized value \p V one lane at a time. @@ -2885,7 +2885,6 @@ void InnerLoopVectorizer::scalarizeInstruction(const Instruction *Instr, VPReplicateRecipe *RepRecipe, const VPIteration &Instance, - bool IfPredicateInstr, VPTransformState &State) { assert(!Instr->getType()->isAggregateType() && "Can't handle vectors"); @@ -2935,6 +2934,7 @@ AC->registerAssumption(II); // End if-block. + bool IfPredicateInstr = RepRecipe->getParent()->getParent()->isReplicator(); if (IfPredicateInstr) PredicatedInstructions.push_back(Cloned); } @@ -9683,8 +9683,7 @@ Instruction *UI = getUnderlyingInstr(); if (State.Instance) { // Generate a single instance. assert(!State.VF.isScalable() && "Can't scalarize a scalable vector"); - State.ILV->scalarizeInstruction(UI, this, *State.Instance, - IsPredicated, State); + State.ILV->scalarizeInstruction(UI, this, *State.Instance, State); // Insert scalar instance packing it into a vector. if (State.VF.isVector() && shouldPack()) { // If we're constructing lane 0, initialize to start from poison. @@ -9706,8 +9705,7 @@ all_of(operands(), [](VPValue *Op) { return Op->isDefinedOutsideVectorRegions(); })) { - State.ILV->scalarizeInstruction(UI, this, VPIteration(0, 0), IsPredicated, - State); + State.ILV->scalarizeInstruction(UI, this, VPIteration(0, 0), State); if (user_begin() != user_end()) { for (unsigned Part = 1; Part < State.UF; ++Part) State.set(this, State.get(this, VPIteration(0, 0)), @@ -9719,8 +9717,7 @@ // Uniform within VL means we need to generate lane 0 only for each // unrolled copy. for (unsigned Part = 0; Part < State.UF; ++Part) - State.ILV->scalarizeInstruction(UI, this, VPIteration(Part, 0), - IsPredicated, State); + State.ILV->scalarizeInstruction(UI, this, VPIteration(Part, 0), State); return; } @@ -9728,7 +9725,7 @@ // needs only the last copy of the store. if (isa(UI) && !getOperand(1)->hasDefiningRecipe()) { auto Lane = VPLane::getLastLaneForVF(State.VF); - State.ILV->scalarizeInstruction(UI, this, VPIteration(State.UF - 1, Lane), IsPredicated, + State.ILV->scalarizeInstruction(UI, this, VPIteration(State.UF - 1, Lane), State); return; } @@ -9738,8 +9735,7 @@ const unsigned EndLane = State.VF.getKnownMinValue(); for (unsigned Part = 0; Part < State.UF; ++Part) for (unsigned Lane = 0; Lane < EndLane; ++Lane) - State.ILV->scalarizeInstruction(UI, this, VPIteration(Part, Lane), - IsPredicated, State); + State.ILV->scalarizeInstruction(UI, this, VPIteration(Part, Lane), State); } void VPWidenMemoryInstructionRecipe::execute(VPTransformState &State) {