[llvm] [VPlan] Add initial loop-invariant code motion transform. (PR #107894)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 13:24:37 PDT 2024


================
@@ -971,6 +971,40 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
     return R.getVPSingleValue()->replaceAllUsesWith(A);
 }
 
+/// Move loop-invariant recipes out of the vector loop region in \p Plan.
+static void licm(VPlan &Plan) {
+  VPRegionBlock *LoopRegion = Plan.getVectorLoopRegion();
+  VPBasicBlock *Preheader =
+      cast<VPBasicBlock>(LoopRegion->getSinglePredecessor());
+
+  // Return true if-and-only-if we know how to (mechanically) both hoist a given
----------------
ayalz wrote:

both?

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


More information about the llvm-commits mailing list