Skip to content

Commit f31c84b

Browse files
committed
merge main into amd-staging
2 parents 2de1778 + 4c46ae3 commit f31c84b

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5750,13 +5750,18 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {
57505750
getMemoryInstructionCost(I, ElementCount::getFixed(1))));
57515751
UpdateMemOpUserCost(cast<LoadInst>(I));
57525752
} else if (const auto *Group = getInterleavedAccessGroup(I)) {
5753-
// Scalarize an interleave group of address loads.
5754-
for (unsigned I = 0; I < Group->getFactor(); ++I) {
5755-
if (Instruction *Member = Group->getMember(I)) {
5756-
setWideningDecision(
5757-
Member, VF, CM_Scalarize,
5758-
(VF.getKnownMinValue() *
5759-
getMemoryInstructionCost(Member, ElementCount::getFixed(1))));
5753+
// Scalarize all members of this interleaved group when any member
5754+
// is used as an address. The address-used load skips scalarization
5755+
// overhead, other members include it.
5756+
for (unsigned Idx = 0; Idx < Group->getFactor(); ++Idx) {
5757+
if (Instruction *Member = Group->getMember(Idx)) {
5758+
InstructionCost Cost =
5759+
AddrDefs.contains(Member)
5760+
? (VF.getKnownMinValue() *
5761+
getMemoryInstructionCost(Member,
5762+
ElementCount::getFixed(1)))
5763+
: getMemInstScalarizationCost(Member, VF);
5764+
setWideningDecision(Member, VF, CM_Scalarize, Cost);
57605765
UpdateMemOpUserCost(cast<LoadInst>(Member));
57615766
}
57625767
}

utils/bazel/llvm-project-overlay/mlir/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4681,6 +4681,8 @@ cc_library(
46814681
":ControlFlowDialect",
46824682
":IR",
46834683
":MemRefDialect",
4684+
":Pass",
4685+
":TransformUtils",
46844686
],
46854687
)
46864688

utils/bazel/llvm-project-overlay/mlir/test/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ cc_library(
386386
"//mlir:CallOpInterfaces",
387387
"//mlir:CommonFolders",
388388
"//mlir:ControlFlowInterfaces",
389+
"//mlir:ControlFlowTransforms",
389390
"//mlir:DLTIDialect",
390391
"//mlir:DataLayoutInterfaces",
391392
"//mlir:DerivedAttributeOpInterface",

0 commit comments

Comments
 (0)