From 53a03a28c4e88816994deaec3a835458b8df35d2 Mon Sep 17 00:00:00 2001 From: Ahmed Bougacha Date: Tue, 8 Nov 2016 19:27:13 +0000 Subject: [PATCH] [GlobalISel] Dump all instructions inserted by selector. This is helpful when multiple instructions are inserted. llvm-svn: 286273 --- llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp index 653c242..6688142 100644 --- a/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -113,13 +113,19 @@ bool InstructionSelect::runOnMachineFunction(MachineFunction &MF) { 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'; + }); } } -- 2.7.4