Skip to content

Commit 030511c

Browse files
committed
!fixup address comments, thanks
1 parent f1e79c2 commit 030511c

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,11 @@ class VPIRMetadata {
936936
/// Copy constructor for cloning.
937937
VPIRMetadata(const VPIRMetadata &Other) : Metadata(Other.Metadata) {}
938938

939+
VPIRMetadata &operator=(const VPIRMetadata &Other) {
940+
Metadata = Other.Metadata;
941+
return *this;
942+
}
943+
939944
/// Add all metadata to \p I.
940945
void applyMetadata(Instruction &I) const;
941946

@@ -944,7 +949,7 @@ class VPIRMetadata {
944949
Metadata.emplace_back(Kind, Node);
945950
}
946951

947-
/// Intersect the this VPIRMetada objet with \p MD, keeping only metadata
952+
/// Intersect this VPIRMetada object with \p MD, keeping only metadata
948953
/// nodes in both.
949954
void intersect(const VPIRMetadata &MD);
950955
};

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2612,12 +2612,8 @@ void VPlanTransforms::createInterleaveGroups(
26122612
VPDominatorTree VPDT;
26132613
VPDT.recalculate(Plan);
26142614
for (const auto *IG : InterleaveGroups) {
2615-
// Get or create the start address for the interleave group.
2616-
auto *Start =
2617-
cast<VPWidenMemoryRecipe>(RecipeBuilder.getRecipe(IG->getMember(0)));
2618-
2619-
VPIRMetadata InterleaveMD(*Start);
26202615
SmallVector<VPValue *, 4> StoredValues;
2616+
VPIRMetadata InterleaveMD;
26212617
for (unsigned i = 0; i < IG->getFactor(); ++i) {
26222618
Instruction *MemI = IG->getMember(i);
26232619
if (!MemI)
@@ -2628,7 +2624,11 @@ void VPlanTransforms::createInterleaveGroups(
26282624
continue;
26292625
if (auto *StoreR = dyn_cast<VPWidenStoreRecipe>(MemR))
26302626
StoredValues.push_back(StoreR->getStoredValue());
2631-
InterleaveMD.intersect(*MemR);
2627+
2628+
if (i == 0)
2629+
InterleaveMD = VPIRMetadata(*MemR);
2630+
else
2631+
InterleaveMD.intersect(*MemR);
26322632
}
26332633

26342634
bool NeedsMaskForGaps =
@@ -2644,6 +2644,9 @@ void VPlanTransforms::createInterleaveGroups(
26442644
getLoadStorePointerOperand(IRInsertPos)->stripPointerCasts()))
26452645
NW = Gep->getNoWrapFlags().withoutNoUnsignedWrap();
26462646

2647+
// Get or create the start address for the interleave group.
2648+
auto *Start =
2649+
cast<VPWidenMemoryRecipe>(RecipeBuilder.getRecipe(IG->getMember(0)));
26472650
VPValue *Addr = Start->getAddr();
26482651
VPRecipeBase *AddrDef = Addr->getDefiningRecipe();
26492652
if (AddrDef && !VPDT.properlyDominates(AddrDef, InsertPos)) {

0 commit comments

Comments
 (0)