[LV] Use early return to simplify code structure

This commit is contained in:
Philip Reames 2022-07-22 12:12:05 -07:00 committed by Philip Reames
parent a71a01bc10
commit b5c7213647
1 changed files with 13 additions and 6 deletions

View File

@ -9569,12 +9569,19 @@ void VPReplicateRecipe::execute(VPTransformState &State) {
return;
}
// Generate scalar instances for all VF lanes of all UF parts, unless the
// instruction is uniform inwhich case generate only the first lane for each
// of the UF parts.
unsigned EndLane = IsUniform ? 1 : State.VF.getKnownMinValue();
assert((!State.VF.isScalable() || IsUniform) &&
"Can't scalarize a scalable vector");
if (IsUniform) {
// 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(getUnderlyingInstr(), this,
VPIteration(Part, 0), IsPredicated,
State);
return;
}
// Generate scalar instances for all VF lanes of all UF parts.
assert(!State.VF.isScalable() && "Can't scalarize a scalable vector");
const unsigned EndLane = State.VF.getKnownMinValue();
for (unsigned Part = 0; Part < State.UF; ++Part)
for (unsigned Lane = 0; Lane < EndLane; ++Lane)
State.ILV->scalarizeInstruction(getUnderlyingInstr(), this,