@@ -2612,23 +2612,23 @@ void VPlanTransforms::createInterleaveGroups(
26122612 VPDominatorTree VPDT;
26132613 VPDT.recalculate (Plan);
26142614 for (const auto *IG : InterleaveGroups) {
2615+ auto *Start =
2616+ cast<VPWidenMemoryRecipe>(RecipeBuilder.getRecipe (IG->getMember (0 )));
2617+
2618+ VPIRMetadata InterleaveMD (*Start);
26152619 SmallVector<VPValue *, 4 > StoredValues;
2616- VPIRMetadata InterleaveMD;
2617- for (unsigned i = 0 ; i < IG->getFactor (); ++i) {
2618- Instruction *MemI = IG->getMember (i);
2620+ if (auto *StoreR = dyn_cast<VPWidenStoreRecipe>(Start))
2621+ StoredValues.push_back (StoreR->getStoredValue ());
2622+ for (unsigned I = 1 ; I < IG->getFactor (); ++I) {
2623+ Instruction *MemI = IG->getMember (I);
26192624 if (!MemI)
26202625 continue ;
26212626 VPWidenMemoryRecipe *MemR =
26222627 cast<VPWidenMemoryRecipe>(RecipeBuilder.getRecipe (MemI));
2623- if (!MemR)
2624- continue ;
2625- if (auto *StoreR = dyn_cast<VPWidenStoreRecipe>(MemR))
2626- StoredValues.push_back (StoreR->getStoredValue ());
2627-
2628- if (i == 0 )
2629- InterleaveMD = VPIRMetadata (*MemR);
2630- else
2631- InterleaveMD.intersect (*MemR);
2628+ if (!StoredValues.empty ())
2629+ StoredValues.push_back (
2630+ cast<VPWidenStoreRecipe>(MemR)->getStoredValue ());
2631+ InterleaveMD.intersect (*MemR);
26322632 }
26332633
26342634 bool NeedsMaskForGaps =
@@ -2645,8 +2645,6 @@ void VPlanTransforms::createInterleaveGroups(
26452645 NW = Gep->getNoWrapFlags ().withoutNoUnsignedWrap ();
26462646
26472647 // Get or create the start address for the interleave group.
2648- auto *Start =
2649- cast<VPWidenMemoryRecipe>(RecipeBuilder.getRecipe (IG->getMember (0 )));
26502648 VPValue *Addr = Start->getAddr ();
26512649 VPRecipeBase *AddrDef = Addr->getDefiningRecipe ();
26522650 if (AddrDef && !VPDT.properlyDominates (AddrDef, InsertPos)) {
0 commit comments