[llvm] [LoopInterchange] Hoist isCompuatableLoopNest() in the control flow (PR #124247)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 06:01:10 PST 2025


================
@@ -1756,10 +1754,23 @@ PreservedAnalyses LoopInterchangePass::run(LoopNest &LN,
   // Ensure minimum depth of the loop nest to do the interchange.
   if (!hasSupportedLoopDepth(LoopList, ORE))
     return PreservedAnalyses::all();
+  // Ensure computable loop nest.
+  if (!isComputableLoopNest(&AR.SE, LoopList)) {
+    LLVM_DEBUG(dbgs() << "Not valid loop candidate for interchange\n");
+    return PreservedAnalyses::all();
+  }
+
+  ORE.emit([&]() {
+    return OptimizationRemark(DEBUG_TYPE, "Dependence",
----------------
madhur13490 wrote:

I am fine with using `dbgs()` but it forces us to rely on asserts build and thus limits the test coverage. We discussed this in my previous PRs like [here](https://github.com/llvm/llvm-project/pull/118656) 
I agree with choices between `OptimizationRemark` vs `Analysis`. If we agree on Remarks, I will change to `OptimizationRemarkAnalysis`. WDYT @sjoerdmeijer @CongzheUalberta ?

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


More information about the llvm-commits mailing list