[llvm] [SCEV] Collect and merge loop guards through PHI nodes with multiple incoming values (PR #113915)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 03:18:14 PST 2024


================
@@ -1316,6 +1316,25 @@ class ScalarEvolution {
 
     LoopGuards(ScalarEvolution &SE) : SE(SE) {}
 
+    /// Recursively collect loop guards in \p Guards, starting from
+    /// block \p Block with predecessor \p Pred. The intended starting point
+    /// is to collect from a loop header and its predecessor.
+    static void
+    collectFromBlock(ScalarEvolution &SE, ScalarEvolution::LoopGuards &Guards,
+                     const BasicBlock *Block, const BasicBlock *Pred,
+                     SmallPtrSet<const BasicBlock *, 8> &VisitedBlocks,
----------------
fhahn wrote:

```suggestion
                     SmallPtrSetImpl<const BasicBlock *> &VisitedBlocks,
```

I think that should work and wouldnt' tie the API to a specific size

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


More information about the llvm-commits mailing list