[llvm] [DependenceAnalysis] Improve debug messages (PR #156367)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 3 01:35:27 PDT 2025


================
@@ -3419,20 +3419,32 @@ bool DependenceInfo::tryDelinearizeFixedSize(
       size_t SSize = Subscripts.size();
       for (size_t I = 1; I < SSize; ++I) {
         const SCEV *S = Subscripts[I];
-        if (!isKnownNonNegative(S, Ptr))
+        if (!isKnownNonNegative(S, Ptr)) {
+          LLVM_DEBUG({
+            dbgs() << "Check failed: !isKnownNonNegative(S, Ptr)\n";
+            dbgs() << "  S: " << *S << "\n" << "  Ptr: " << *Ptr << "\n";
+          });
           return false;
+        }
         if (auto *SType = dyn_cast<IntegerType>(S->getType())) {
           const SCEV *Range = SE->getConstant(
               ConstantInt::get(SType, DimensionSizes[I - 1], false));
-          if (!isKnownLessThan(S, Range))
+          if (!isKnownLessThan(S, Range)) {
+            LLVM_DEBUG({
+              dbgs() << "Check failed: !isKnownLessThan(S, Range)\n";
+              dbgs() << "  S: " << *S << "\n"
+                     << "  Range: " << *Range << "\n";
+            });
             return false;
+          }
         }
       }
       return true;
     };
 
     if (!AllIndicesInRange(SrcSizes, SrcSubscripts, SrcPtr) ||
         !AllIndicesInRange(DstSizes, DstSubscripts, DstPtr)) {
+      LLVM_DEBUG(dbgs() << "Check failed: AllIndicesInRange.\n");
----------------
kasuga-fj wrote:

Currently, when the range check fails, the debug output looks like:

```
Check failed: !isKnownLessThan(S, Range)
  S: {0,+,1}<nuw><nsw><%loop.j>
  Range: 256
Check failed: AllIndicesInRange.
```

I think the last line is redundant. 

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


More information about the llvm-commits mailing list