[llvm] [LoopVersioningLICM] Only mark pointers with generated checks as noalias (PR #135168)
    Nikita Popov via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 30 06:13:50 PDT 2025
    
    
  
================
@@ -344,6 +343,13 @@ bool LoopVersioningLICM::instructionSafeForVersioning(Instruction *I) {
     }
     LoadAndStoreCounter++;
     Value *Ptr = St->getPointerOperand();
+    // Don't allow stores that we don't have runtime checks for, as we won't be
+    // able to mark them noalias meaning they would prevent any code motion.
+    auto &Pointers = LAI->getRuntimePointerChecking()->Pointers;
+    if (!any_of(Pointers, [&](auto &P) { return P.PointerValue == Ptr; })) {
+      LLVM_DEBUG(dbgs() << "    Found a store without a runtime check.\n");
+      return false;
+    }
----------------
nikic wrote:
Is this check needed for this patch, or for the future LAA change you have in mind?
https://github.com/llvm/llvm-project/pull/135168
    
    
More information about the llvm-commits
mailing list