[llvm] [VPlanTransform] Specialize simplifyRecipe for VPSingleDefRecipe pointer. nfc (PR #165568)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 30 01:38:42 PDT 2025


================
@@ -1057,54 +1057,51 @@ static VPValue *tryToFoldLiveIns(VPSingleDefRecipe &R,
   return nullptr;
 }
 
-/// Try to simplify recipe \p R.
-static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
-  VPlan *Plan = R.getParent()->getPlan();
-
-  auto *Def = dyn_cast<VPSingleDefRecipe>(&R);
-  if (!Def)
-    return;
+/// Try to simplify VPSingleDefRecipe \p Def.
+static void simplifySingleDefRecipe(VPSingleDefRecipe &Def,
+                                    VPTypeAnalysis &TypeInfo) {
+  VPlan *Plan = Def.getParent()->getPlan();
 
   // Simplification of live-in IR values for SingleDef recipes using
   // InstSimplifyFolder.
   const DataLayout &DL =
       Plan->getScalarHeader()->getIRBasicBlock()->getDataLayout();
-  if (VPValue *V = tryToFoldLiveIns(*Def, Def->operands(), DL, TypeInfo))
-    return Def->replaceAllUsesWith(V);
+  if (VPValue *V = tryToFoldLiveIns(Def, Def.operands(), DL, TypeInfo))
+    return Def.replaceAllUsesWith(V);
----------------
Mel-Chen wrote:

Sure. 
8043f76398b19a08cae59953f4c80d94c6cc4920

https://github.com/llvm/llvm-project/pull/165568


More information about the llvm-commits mailing list