[PATCH] D159200: [VPlan] Fold (MUL A, 1) -> A as VPlan2VPlan transform.
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 05:28:56 PDT 2023
Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.
LGTM, adding various nits and thoughts.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:803
+/// Returns true is \p V is constant one.
+static bool isConstantOne(VPValue *V) {
+ if (!V->isLiveIn())
----------------
nit: could become a method of VPValue?
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:811
+/// Returns the llvm::Instruction opcode for \p R.
+static unsigned getOpcodeForRecipe(VPRecipeBase &R) {
+ if (auto *WidenR = dyn_cast<VPWidenRecipe>(&R))
----------------
Also handle VPInstruction via its getOpcode()?
nit: could become a method of VPRecipeBase?
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:819
+
+/// Try to simplify recipe \p R.
+static void simplifyRecipe(VPRecipeBase &R) {
----------------
nit: would "constantFold" be more accurate than the general "simplify"?
Comment that collecting R's folded into their operands is left for subsequent DCE.
May be worth indicating if any change was made, at some point - relevant for VPlan2VPlan passes in general.
May be worth testing that Mul 1, 1 gets optimized into a live-in.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:832
+
+/// Try to simplify the recipes in \p Plan.
+static void simplifyRecipes(VPlan &Plan) {
----------------
nit: would "constantFold" be more accurate than the general "simplify"?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159200/new/
https://reviews.llvm.org/D159200
More information about the llvm-commits
mailing list