[llvm] [VPlan] Extend licm to hoist replicate loads (PR #179506)

Andrei Elovikov via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 09:08:56 PDT 2026


================
@@ -2695,7 +2723,9 @@ static void licm(VPlan &Plan) {
   for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
            vp_depth_first_shallow(LoopRegion->getEntry()))) {
     for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
-      if (cannotHoistOrSinkRecipe(R))
+      if (cannotHoistOrSinkRecipe(R, LoadGroups,
+                                  LoopRegion->getEntryBasicBlock(),
+                                  LoopRegion->getExitingBasicBlock()))
----------------
eas wrote:

I don't see any additional checks after `canSinkOrHoistInst` in https://github.com/llvm/llvm-project/blob/69112990ebc6ade572b74c79e2535aa3bbf071fa/llvm/lib/Transforms/Scalar/LICM.cpp#L605-L616 yet we do require them here for **correctness**. That is what's confusing me.

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


More information about the llvm-commits mailing list