[llvm] [LoopInterchange] Don't consider loops with BTC=0 (PR #167113)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 01:47:20 PST 2025


================
@@ -2114,6 +2135,7 @@ PreservedAnalyses LoopInterchangePass::run(LoopNest &LN,
                                            LPMUpdater &U) {
   Function &F = *LN.getParent();
   SmallVector<Loop *, 8> LoopList(LN.getLoops());
+  std::map<const Loop *, const SCEV *> LoopBTC;
----------------
kasuga-fj wrote:

ScalarEvolution caches the results of BTC. In general, it would be better to call `getBackedgeTakenCount` every time than holding local cache unless there are special circumstances.

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


More information about the llvm-commits mailing list