[llvm] [InstCombine] Sink instructions across assumes (PR #205314)

Nikolas Klauser via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 10:48:52 PDT 2026


================
@@ -5629,7 +5629,7 @@ bool InstCombinerImpl::tryToSinkInstruction(Instruction *I,
     for (BasicBlock::iterator Scan = std::next(I->getIterator()),
                               E = I->getParent()->end();
          Scan != E; ++Scan)
-      if (Scan->mayWriteToMemory())
+      if (Scan->mayWriteToMemory() && !isa<AssumeInst>(Scan))
----------------
philnik777 wrote:

Would this be correct in general? Wouldn't that make it possible to move an instruction which only reads from inaccessible memory move across one that only writes to inaccessible memory?

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


More information about the llvm-commits mailing list