[llvm] LSV: forbid load-cycles when vectorizing; fix bug (PR #104815)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 12:14:16 PDT 2024


================
@@ -996,10 +996,32 @@ bool Vectorizer::isSafeToMove(
   LLVM_DEBUG(dbgs() << "LSV: isSafeToMove(" << *ChainElem << " -> "
                     << *ChainBegin << ")\n");
 
-  assert(isa<LoadInst>(ChainElem) == IsLoadChain);
+  assert(isa<LoadInst>(ChainElem) == IsLoadChain &&
+         isa<LoadInst>(ChainBegin) == IsLoadChain);
+
   if (ChainElem == ChainBegin)
     return true;
 
+  if constexpr (IsLoadChain) {
----------------
artagnon wrote:

Yes. However, it's hard to reason about, and I'm starting to think that there may be false positives with that SCEV patch.

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


More information about the llvm-commits mailing list