Skip to content

Commit d0f7329

Browse files
committed
[LV] Also handle non-uniform scalarized loads when processing AddrDefs.
Loads of addresses are scalarized and have their costs computed w/o scalarization overhead. Consistently apply this logic also to non-uniform loads that are already scalarized, to ensure their costs are consistent with other scalarized lodas that are used as addresses. (cherry picked from commit 7dd9b3d)
1 parent a323a92 commit d0f7329

File tree

3 files changed

+805
-6
lines changed

3 files changed

+805
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5738,8 +5738,11 @@ void LoopVectorizationCostModel::setCostBasedWideningDecision(ElementCount VF) {
57385738
// if the loaded register is involved in an address computation, it is
57395739
// instead changed here when we know this is the case.
57405740
InstWidening Decision = getWideningDecision(I, VF);
5741-
if (Decision == CM_Widen || Decision == CM_Widen_Reverse)
5742-
// Scalarize a widened load of address.
5741+
if (Decision == CM_Widen || Decision == CM_Widen_Reverse ||
5742+
(!isPredicatedInst(I) && !Legal->isUniformMemOp(*I, VF) &&
5743+
Decision == CM_Scalarize))
5744+
// Scalarize a widened load of address or update the cost of a scalar
5745+
// load of an address.
57435746
setWideningDecision(
57445747
I, VF, CM_Scalarize,
57455748
(VF.getKnownMinValue() *

0 commit comments

Comments
 (0)