[llvm] r286273 - [GlobalISel] Dump all instructions inserted by selector.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 11:27:13 PST 2016


Author: ab
Date: Tue Nov  8 13:27:13 2016
New Revision: 286273

URL: http://llvm.org/viewvc/llvm-project?rev=286273&view=rev
Log:
[GlobalISel] Dump all instructions inserted by selector.

This is helpful when multiple instructions are inserted.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp?rev=286273&r1=286272&r2=286273&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/InstructionSelect.cpp Tue Nov  8 13:27:13 2016
@@ -113,13 +113,19 @@ bool InstructionSelect::runOnMachineFunc
 
       if (!ISel->select(MI)) {
         if (TPC.isGlobalISelAbortEnabled())
-          // FIXME: It would be nice to dump all inserted instructions.  It's
-          // not
-          // obvious how, esp. considering select() can insert after MI.
           reportSelectionError(MI, "Cannot select");
         Failed = true;
         break;
       }
+
+      // Dump the range of instructions that MI expanded into.
+      DEBUG({
+        auto InsertedBegin = ReachedBegin ? MBB->begin() : std::next(MII);
+        dbgs() << "Into:\n";
+        for (auto &InsertedMI : make_range(InsertedBegin, AfterIt))
+          dbgs() << "  " << InsertedMI;
+        dbgs() << '\n';
+      });
     }
   }
 




More information about the llvm-commits mailing list