From 9da8087b94575da0b19fa06822d6c95320728103 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286273 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/GlobalISel/InstructionSelect.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/lib/CodeGen/GlobalISel/InstructionSelect.cpp index 653c2428441..66881426994 100644 --- a/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/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.50.1