[llvm] [Sink] Allow sinking of loads to distant blocks (PR #135986)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 17 11:31:15 PDT 2025


================
@@ -60,10 +75,37 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis &AA,
   return true;
 }
 
+typedef SmallPtrSet<BasicBlock *, 8> BlocksSet;
+static void findStores(SmallPtrSetImpl<Instruction *> &Stores,
+                       BasicBlock *LoadBB, BasicBlock *BB,
+                       BlocksSet &VisitedBlocksSet) {
+  if (BB == LoadBB || VisitedBlocksSet.contains(BB))
+    return;
+  VisitedBlocksSet.insert(BB);
----------------
shiltian wrote:

avoid two lookup here

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


More information about the llvm-commits mailing list