[llvm] r358471 - [CodeExtractor] Add a few debug lines to understand why a region is not extracted

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 15 19:12:05 PDT 2019


Author: qcolombet
Date: Mon Apr 15 19:12:05 2019
New Revision: 358471

URL: http://llvm.org/viewvc/llvm-project?rev=358471&view=rev
Log:
[CodeExtractor] Add a few debug lines to understand why a region is not extracted

The CodeExtractor is not smart enough to compute which basic block is
the entry of a region. Instead it relies on the order of the list
of basic blocks that is handed to it and assumes that the entry
is the first block in the list.

Without the additional debug information, it is hard to understand
why a valid region does not get extracted, because we would miss
that the order of in the list just doesn't match what the CodeExtractor
wants.

NFC

Modified:
    llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp

Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=358471&r1=358470&r2=358471&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Mon Apr 15 19:12:05 2019
@@ -209,6 +209,9 @@ buildExtractionBlockSet(ArrayRef<BasicBl
       llvm_unreachable("Repeated basic blocks in extraction input");
   }
 
+  LLVM_DEBUG(dbgs() << "Region front block: " << Result.front()->getName()
+                    << '\n');
+
   for (auto *BB : Result) {
     if (!isBlockValidForExtraction(*BB, Result, AllowVarArgs, AllowAlloca))
       return {};
@@ -226,9 +229,11 @@ buildExtractionBlockSet(ArrayRef<BasicBl
     // the subgraph which is being extracted.
     for (auto *PBB : predecessors(BB))
       if (!Result.count(PBB)) {
-        LLVM_DEBUG(
-            dbgs() << "No blocks in this region may have entries from "
-                      "outside the region except for the first block!\n");
+        LLVM_DEBUG(dbgs() << "No blocks in this region may have entries from "
+                             "outside the region except for the first block!\n"
+                          << "Problematic source BB: " << BB->getName() << "\n"
+                          << "Problematic destination BB: " << PBB->getName()
+                          << "\n");
         return {};
       }
   }




More information about the llvm-commits mailing list