[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:27:23 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:

https://github.com/llvm/llvm-project/blob/69112990ebc6ade572b74c79e2535aa3bbf071fa/llvm/lib/Transforms/Scalar/LICM.cpp#L1570-L1575

> This method is guaranteed to remove the original instruction from its position

>  think the return value of the sink function is a more complex version of the legality check we have here

seem to contradict each other...

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


More information about the llvm-commits mailing list