[llvm] [LoopInterchange] Constrain number of load/stores in a loop (PR #118973)

Sjoerd Meijer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 03:36:48 PST 2025


================
@@ -109,7 +115,16 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
 
   LLVM_DEBUG(dbgs() << "Found " << MemInstr.size()
                     << " Loads and Stores to analyze\n");
-
+  if (MemInstr.size() > MaxMemInstrCount) {
+    LLVM_DEBUG(dbgs() << "The transform doesn't support more than "
+                      << MaxMemInstrCount << " load stores in a loop\n");
+    ORE->emit([&]() {
+      return OptimizationRemarkMissed(DEBUG_TYPE, "UnsupportedLoop",
+                                      L->getStartLoc(), L->getHeader())
+             << "Number of loads/stores in the loop are more than threshold.";
----------------
sjoerdmeijer wrote:

Nit:  " .... more than threshold": I would like to add something about which threshold exactly we're  talking about here.   Or the message could be something like

    Number of supported loads/stores exceeded, the supported maximum can be increased
    with option -loop-interchange-max-meminstr-count

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


More information about the llvm-commits mailing list