[llvm] [VPlan] Introduce VPlan-level constant folder (PR #125365)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 7 13:59:54 PDT 2025


================
@@ -1073,13 +1140,14 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
   }
 }
 
-void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
+void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy,
+                                      const DataLayout &DL) {
   ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT(
       Plan.getEntry());
   VPTypeAnalysis TypeInfo(&CanonicalIVTy);
   for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(RPOT)) {
     for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
-      simplifyRecipe(R, TypeInfo);
+      simplifyRecipe(R, TypeInfo, DL);
----------------
fhahn wrote:

Would it be possible to retrieve DL from `Plan`, by using the scalar header IR BB, which is always available, something like `Plan.getScalarHeader()->getIRBasicBlock()->getDataLayout()`?

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


More information about the llvm-commits mailing list