[llvm] [VPlan] Clarify legality check in licm (NFC) (PR #162486)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 09:08:24 PDT 2025


================
@@ -2107,27 +2107,30 @@ static void licm(VPlan &Plan) {
   VPBasicBlock *Preheader = Plan.getVectorPreheader();
 
   // Return true if we do not know how to (mechanically) hoist a given recipe
-  // out of a loop region. Does not address legality concerns such as aliasing
-  // or speculation safety.
+  // out of a loop region.
   auto CannotHoistRecipe = [](VPRecipeBase &R) {
+    // TODO: Relax checks in the future, e.g. we could also hoist reads, if
+    // their memory location is not modified in the vector loop.
+    if (R.mayReadOrWriteMemory() || R.isPhi())
----------------
artagnon wrote:

Thanks, I misread the IR-LICM code, and this patch is now an NFC, to prepare to permit assumes.

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


More information about the llvm-commits mailing list