[llvm] [LCSSA] Cache the loop exit blocks across recursive analysis (NFC) (PR #101087)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 14:55:34 PDT 2024


================
@@ -74,21 +74,17 @@ static bool isExitBlock(BasicBlock *BB,
 /// For every instruction from the worklist, check to see if it has any uses
 /// that are outside the current loop.  If so, insert LCSSA PHI nodes and
 /// rewrite the uses.
-bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
-                                    const DominatorTree &DT, const LoopInfo &LI,
-                                    ScalarEvolution *SE,
-                                    SmallVectorImpl<PHINode *> *PHIsToRemove,
-                                    SmallVectorImpl<PHINode *> *InsertedPHIs) {
+static bool formLCSSAForInstructionsWorker(
+    SmallVectorImpl<Instruction *> &Worklist, const DominatorTree &DT,
+    const LoopInfo &LI, ScalarEvolution *SE,
+    SmallVectorImpl<PHINode *> *PHIsToRemove,
+    SmallVectorImpl<PHINode *> *InsertedPHIs,
+    SmallDenseMap<Loop *, SmallVector<BasicBlock *, 1>> &LoopExitBlocks) {
----------------
nikic wrote:

`using LoopExitBlocksTy = SmallDenseMap<Loop *, SmallVector<BasicBlock *, 1>>` or so? This is repeated quite a few times and includes implementation details, like the small vector size.

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


More information about the llvm-commits mailing list