[llvm] [LV] Optimize VPWidenIntOrFpInductionRecipe for known TC (PR #118828)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 17 06:52:27 PST 2024
================
@@ -661,14 +661,16 @@ static void recursivelyDeleteDeadRecipes(VPValue *V) {
}
}
-void VPlanTransforms::optimizeForTCAndVF(VPlan &Plan, unsigned TC,
- ElementCount BestVF) {
+void VPlanTransforms::optimizeForTCAndVFAndUF(VPlan &Plan, unsigned TC,
+ ElementCount BestVF,
+ unsigned BestUF) {
assert(Plan.hasVF(BestVF) && "BestVF is not available in Plan");
+ assert(Plan.hasUF(BestUF) && "BestUF is not available in Plan");
if (!TC || !BestVF.isFixed())
return;
- // Calculate the widest type required for known TC and VF.
- uint64_t Width = BestVF.getKnownMinValue();
+ // Calculate the widest type required for known TC, VF and UF.
+ uint64_t Width = BestVF.getKnownMinValue() * BestUF;
----------------
david-arm wrote:
After making this change I didn't see any corresponding change in the tests, which looks we have a missing test case. Is it possible to create a very simple test that is affected by this change? For example, if you have a known trip count of 50 and use `-force-vector-width=64 -force-vector-interleave=8` then the max value will be 511 and will require an i16 type. That's still better than an i64 type though!
https://github.com/llvm/llvm-project/pull/118828
More information about the llvm-commits
mailing list