[PATCH] D124926: [LoopInterchange] New cost model for loop interchange

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 31 11:06:22 PDT 2022


bmahjour added a comment.

> ...With LNICM the load of z is again hoisted into entry, and since entry is the preheader of the original outer loop, after interchange load of z is moved into for.body3.preheader, which is the new outer loop preheader....before this patch, the entry block is not considered part of the loop ...

>From what I can see, the "entry" is the preheader of the original outer loop in both cases, so not sure why it's treated differently. Maybe it's better to separate out the INTC, LNICM and LICM checks and show the full context for each set to better understand what's going on?



================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:514-515
+    //
+    // For the new pass manager CacheCost should not be null, which is not
+    // the case for the old pass manager.
+    DenseMap<const Loop *, unsigned> CostMap;
----------------



================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:1175-1176
+    OuterIndex = CostMap.find(OuterLoop)->second;
+    LLVM_DEBUG(dbgs() << "IndexInner = " << InnerIndex
+                      << ", IndexOuter = " << OuterIndex << "\n");
+    if (InnerIndex < OuterIndex)
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124926/new/

https://reviews.llvm.org/D124926



More information about the llvm-commits mailing list