[llvm] [VPlan] Introduce chainUsesScalarValues (PR #158377)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 29 09:02:23 PDT 2025
================
@@ -30,6 +30,30 @@ bool vputils::onlyScalarValuesUsed(const VPValue *Def) {
[Def](const VPUser *U) { return U->usesScalars(Def); });
}
+bool vputils::chainUsesScalarValues(const VPValue *Root) {
+ SmallVector<std::pair<const VPValue *, const VPUser *>> Worklist;
+ for (const VPUser *V : Root->users())
+ Worklist.emplace_back(Root, V);
+ while (!Worklist.empty()) {
+ auto [Op, U] = Worklist.pop_back_val();
+ if (isa<VPWidenRecipe, VPWidenCastRecipe, VPWidenCallRecipe,
----------------
artagnon wrote:
Certain widens cannot be narrowed as they don't have an underlying value that would permit us to turn them into single-scalars: for example, VPWidenCast and VPWidenIntrinsic. All the usesScalars are correct as they are written; I think you meant onlyScalarvaluesUsed in VPlanUtils, which is used by more than just optimizations: it is also used in the execution of recipes, and chainUsesScalars is a version that's suitable for optimizations like narrowToSingleScalars.
https://github.com/llvm/llvm-project/pull/158377
More information about the llvm-commits
mailing list