Skip to content

Commit 26b82fa

Browse files
committed
[VPlan] Fix WidenStore-related thinko, add comment
1 parent c07d947 commit 26b82fa

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
@@ -43,8 +43,16 @@ bool vputils::chainUsesScalarValues(const VPValue *Root) {
4343
Worklist.emplace_back(Def, V);
4444
continue;
4545
}
46-
if (isa<VPWidenMemoryRecipe>(U) && vputils::isSingleScalar(Op))
46+
47+
// It is always profitable to widen stores, even if the address or stored
48+
// value are single-scalars: checking that the operand is single-scalar in
49+
// WidenStores is an important leaf condition of chainUsesScalarValues, as
50+
// WidenStores have no users, and checking that the address or stored-val is
51+
// single-scalar allows the chains of uses to be determined to use scalar
52+
// values (and can be narowed in an optimization routine, for example).
53+
if (isa<VPWidenStoreRecipe>(U) && vputils::isSingleScalar(Op))
4754
continue;
55+
4856
if (auto *VPI = dyn_cast<VPInstruction>(U))
4957
if (VPI->isVectorToScalar() || VPI->isSingleScalar())
5058
continue;

0 commit comments

Comments
 (0)