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

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 30 13:55:46 PDT 2024


================
@@ -317,6 +316,23 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
   return Changed;
 }
 
+/// 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) {
+  // Cache the Loop ExitBlocks computed during the analysis.  We expect to get a
+  // lot of instructions within the same loops, computing the exit blocks is
+  // expensive, and we're not mutating the loop structure.
----------------
teresajohnson wrote:

done

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


More information about the llvm-commits mailing list