[llvm] [LoopInterchange] Don't consider loops with BTC=0 (PR #167113)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 18 03:08:30 PST 2025
================
@@ -602,14 +606,17 @@ struct LoopInterchange {
DependenceInfo *DI = nullptr;
DominatorTree *DT = nullptr;
LoopStandardAnalysisResults *AR = nullptr;
-
/// Interface to emit optimization remarks.
OptimizationRemarkEmitter *ORE;
+ // A cache to avoid recalculating the backedge-taken count for a loop.
+ std::map<const Loop *, const SCEV *> LoopBTC;
----------------
Meinersbur wrote:
```suggestion
// A cache to avoid recalculating the backedge-taken count for a loop.
DenseMap<const Loop *, const SCEV *> LoopBTC;
```
Avoid `std::map` if not needed, it has *terrible* runtime and memory characteristics: no hashing but binary tree, one malloc per entry.
<img width="700" height="500" alt="rnw9R" src="https://github.com/user-attachments/assets/2f51c4f5-1cb6-4fd0-8a7c-60d8e2af865b" />
https://stackoverflow.com/questions/43191216/differences-similarities-between-llvmdensemap-and-stdmap
https://github.com/llvm/llvm-project/pull/167113
More information about the llvm-commits
mailing list