[llvm] [LoopVersioningLICM] Only mark pointers with generated checks as noalias (PR #135168)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed May 7 14:04:04 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;
+ }
----------------
fhahn wrote:
Hmm, but doesn't LVer.annotateLoopWithNoAlias() automatically take care of this? It should only add annotations to instructions it has RT checks for
https://github.com/llvm/llvm-project/pull/135168
More information about the llvm-commits
mailing list