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

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 9 20:05:33 PST 2025


================
@@ -428,6 +434,13 @@ static bool isComputableLoopNest(ScalarEvolution *SE,
       LLVM_DEBUG(dbgs() << "Couldn't compute backedge count\n");
       return false;
     }
+    // A loop with a backedge that isn't taken, e.g. an unconditional branch
+    // true, isn't really a loop and we don't want to consider it as a
+    // candidate.
+    if (ExitCountOuter && SkipLoopsWithZeroBTC && ExitCountOuter->isZero()) {
+      LLVM_DEBUG(dbgs() << "Single iteration loop\n");
----------------
madhur13490 wrote:

Slightly more verbose message would be useful.

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


More information about the llvm-commits mailing list