[llvm] [VPlan] Sink recipes from the vector loop region in licm. (PR #168031)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 27 06:38:37 PST 2026


================
@@ -7149,6 +7149,14 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
             cast<VPRecipeWithIRFlags>(R).getPredicate() !=
                 cast<CmpInst>(UI)->getPredicate())
           return true;
+
+        // Recipes with underlying instructions being moved out of the loop
+        // region by LICM may cause discrepancies between the legacy cost model
+        // and the VPlan-based cost model.
+        if (auto *Def = dyn_cast<VPSingleDefRecipe>(&R))
+          if (Def->isDefinedOutsideLoopRegions())
+            return true;
----------------
fhahn wrote:

Could we just check all defined values, to also cover the case when loads are potentially also sunk in the future?

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


More information about the llvm-commits mailing list