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

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 01:23:46 PST 2025


================
@@ -1462,6 +1463,25 @@ std::optional<bool> LoopInterchangeProfitability::isProfitableForVectorization(
 bool LoopInterchangeProfitability::isProfitable(
     const Loop *InnerLoop, const Loop *OuterLoop, unsigned InnerLoopId,
     unsigned OuterLoopId, CharMatrix &DepMatrix, CacheCostManager &CCM) {
+  // 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
----------------
kasuga-fj wrote:

I think this is a loop by [definition](https://llvm.org/docs/LoopTerminology.html#loop-definition), even if BTC=0. I feel this comment is a bit misleading.

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


More information about the llvm-commits mailing list