[llvm] [BasicBlockUtils] Fixed LoopInfo update in UpdateAnalysisInformation() (PR #177147)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 05:32:31 PST 2026


================
@@ -1054,6 +1054,28 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, BasicBlock::iterator SplitPt,
   return SplitBlockImpl(Old, SplitPt, DTU, /*DT=*/nullptr, LI, MSSAU, BBName);
 }
 
+static bool hasReachableLoopEntry(const Loop &L, const DominatorTree &DT) {
+  for (const auto Pred : inverse_children<const BasicBlock *>(L.getHeader()))
+    if (!L.contains(Pred) && DT.isReachableFromEntry(Pred))
+      return true;
+
+  return false;
+}
+
+// Destroy the loop.
+static void Destroy(Loop *L, LoopInfo &LI) {
+  auto *ParentL = L->getParentLoop();
+  for (auto *BB : L->getBlocks())
----------------
ro-i wrote:

```suggestion
  for (BasicBlock *BB : L->getBlocks())
```

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


More information about the llvm-commits mailing list