[llvm] [LoopInterchange] Constrain LI within supported loop nest depth (PR #118656)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 09:12:01 PST 2024


================
@@ -239,10 +242,12 @@ static void populateWorklist(Loop &L, LoopVector &LoopList) {
   LoopList.push_back(CurrentLoop);
 }
 
-static bool hasMinimumLoopDepth(SmallVectorImpl<Loop *> &LoopList) {
+static bool hasSupportedLoopDepth(SmallVectorImpl<Loop *> &LoopList) {
   unsigned LoopNestDepth = LoopList.size();
-  if (LoopNestDepth < 2) {
-    LLVM_DEBUG(dbgs() << "Loop doesn't contain minimum nesting level.\n");
+  if (LoopNestDepth < MinLoopNestDepth || LoopNestDepth > MaxLoopNestDepth) {
----------------
CongzheUalberta wrote:

I would prefer to make `MaxLoopNestDepth` and `MinLoopNestDepth` to be tunable parameters rather than hardcoded numbers, so we could control with better flexibility.

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


More information about the llvm-commits mailing list