@@ -2312,64 +2312,6 @@ static bool useMaskedInterleavedAccesses(const TargetTransformInfo &TTI) {
23122312 return TTI.enableMaskedInterleavedAccessVectorization ();
23132313}
23142314
2315- // / A helper function to scalarize a single Instruction in the innermost loop.
2316- // / Generates a sequence of scalar instances for lane \p Lane. Uses the VPValue
2317- // / operands from \p RepRecipe instead of \p Instr's operands.
2318- static void scalarizeInstruction (const Instruction *Instr,
2319- VPReplicateRecipe *RepRecipe,
2320- const VPLane &Lane, VPTransformState &State) {
2321- assert ((!Instr->getType ()->isAggregateType () ||
2322- canVectorizeTy (Instr->getType ())) &&
2323- " Expected vectorizable or non-aggregate type." );
2324-
2325- // Does this instruction return a value ?
2326- bool IsVoidRetTy = Instr->getType ()->isVoidTy ();
2327-
2328- Instruction *Cloned = Instr->clone ();
2329- if (!IsVoidRetTy) {
2330- Cloned->setName (Instr->getName () + " .cloned" );
2331- #if !defined(NDEBUG)
2332- // Verify that VPlan type inference results agree with the type of the
2333- // generated values.
2334- assert (State.TypeAnalysis .inferScalarType (RepRecipe) == Cloned->getType () &&
2335- " inferred type and type from generated instructions do not match" );
2336- #endif
2337- }
2338-
2339- RepRecipe->applyFlags (*Cloned);
2340-
2341- if (auto DL = RepRecipe->getDebugLoc ())
2342- State.setDebugLocFrom (DL);
2343-
2344- // Replace the operands of the cloned instructions with their scalar
2345- // equivalents in the new loop.
2346- for (const auto &I : enumerate(RepRecipe->operands ())) {
2347- auto InputLane = Lane;
2348- VPValue *Operand = I.value ();
2349- if (vputils::isUniformAfterVectorization (Operand))
2350- InputLane = VPLane::getFirstLane ();
2351- Cloned->setOperand (I.index (), State.get (Operand, InputLane));
2352- }
2353- State.addNewMetadata (Cloned, Instr);
2354-
2355- // Place the cloned scalar in the new loop.
2356- State.Builder .Insert (Cloned);
2357-
2358- State.set (RepRecipe, Cloned, Lane);
2359-
2360- // If we just cloned a new assumption, add it the assumption cache.
2361- if (auto *II = dyn_cast<AssumeInst>(Cloned))
2362- State.AC ->registerAssumption (II);
2363-
2364- assert (
2365- (RepRecipe->getParent ()->getParent () ||
2366- !RepRecipe->getParent ()->getPlan ()->getVectorLoopRegion () ||
2367- all_of (RepRecipe->operands (),
2368- [](VPValue *Op) { return Op->isDefinedOutsideLoopRegions (); })) &&
2369- " Expected a recipe is either within a region or all of its operands "
2370- " are defined outside the vectorized region." );
2371- }
2372-
23732315Value *
23742316InnerLoopVectorizer::getOrCreateVectorTripCount (BasicBlock *InsertBlock) {
23752317 if (VectorTripCount)
@@ -10081,49 +10023,6 @@ void VPDerivedIVRecipe::execute(VPTransformState &State) {
1008110023 State.set (this , DerivedIV, VPLane (0 ));
1008210024}
1008310025
10084- void VPReplicateRecipe::execute (VPTransformState &State) {
10085- Instruction *UI = getUnderlyingInstr ();
10086- if (State.Lane ) { // Generate a single instance.
10087- assert ((State.VF .isScalar () || !isUniform ()) &&
10088- " uniform recipe shouldn't be predicated" );
10089- assert (!State.VF .isScalable () && " Can't scalarize a scalable vector" );
10090- scalarizeInstruction (UI, this , *State.Lane , State);
10091- // Insert scalar instance packing it into a vector.
10092- if (State.VF .isVector () && shouldPack ()) {
10093- // If we're constructing lane 0, initialize to start from poison.
10094- if (State.Lane ->isFirstLane ()) {
10095- assert (!State.VF .isScalable () && " VF is assumed to be non scalable." );
10096- Value *Poison = PoisonValue::get (
10097- VectorType::get (UI->getType (), State.VF ));
10098- State.set (this , Poison);
10099- }
10100- State.packScalarIntoVectorizedValue (this , *State.Lane );
10101- }
10102- return ;
10103- }
10104-
10105- if (IsUniform) {
10106- // Uniform within VL means we need to generate lane 0.
10107- scalarizeInstruction (UI, this , VPLane (0 ), State);
10108- return ;
10109- }
10110-
10111- // A store of a loop varying value to a uniform address only needs the last
10112- // copy of the store.
10113- if (isa<StoreInst>(UI) &&
10114- vputils::isUniformAfterVectorization (getOperand (1 ))) {
10115- auto Lane = VPLane::getLastLaneForVF (State.VF );
10116- scalarizeInstruction (UI, this , VPLane (Lane), State);
10117- return ;
10118- }
10119-
10120- // Generate scalar instances for all VF lanes.
10121- assert (!State.VF .isScalable () && " Can't scalarize a scalable vector" );
10122- const unsigned EndLane = State.VF .getKnownMinValue ();
10123- for (unsigned Lane = 0 ; Lane < EndLane; ++Lane)
10124- scalarizeInstruction (UI, this , VPLane (Lane), State);
10125- }
10126-
1012710026// Determine how to lower the scalar epilogue, which depends on 1) optimising
1012810027// for minimum code-size, 2) predicate compiler options, 3) loop hints forcing
1012910028// predication, and 4) a TTI hook that analyses whether the loop is suitable
0 commit comments