Skip to content

Commit 83f353d

Browse files
committed
[VPlan] Fix WidenStore-related thinko, add comment
1 parent 22e40f2 commit 83f353d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ bool vputils::chainUsesScalarValues(const VPValue *Root) {
4444
Worklist.emplace_back(Def, V);
4545
continue;
4646
}
47-
if (isa<VPWidenMemoryRecipe>(U) && vputils::isSingleScalar(Op))
47+
48+
// It is always profitable to widen stores, even if the address or stored
49+
// value are single-scalars: checking that the operand is single-scalar in
50+
// WidenStores is an important leaf condition of chainUsesScalarValues, as
51+
// WidenStores have no users, and checking that the address or stored-val is
52+
// single-scalar allows the chains of uses to be determined to use scalar
53+
// values (and can be narowed in an optimization routine, for example).
54+
if (isa<VPWidenStoreRecipe>(U) && vputils::isSingleScalar(Op))
4855
continue;
56+
4957
if (auto *VPI = dyn_cast<VPInstruction>(U))
5058
if (VPI->isVectorToScalar() || VPI->isSingleScalar())
5159
continue;

0 commit comments

Comments
 (0)