Index: lib/CodeGen/GlobalISel/InstructionSelect.cpp =================================================================== --- lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -100,8 +100,9 @@ for (auto MII = std::prev(MBB->end()), Begin = MBB->begin(); !ReachedBegin;) { // Keep track of the insertion range for debug printing. - const auto AfterIt = std::next(MII); - + DEBUG({ + const auto AfterIt = std::next(MII); + }); // Select this instruction. MachineInstr &MI = *MII; @@ -134,6 +135,7 @@ } } +#ifndef NDEBUG // Now that selection is complete, there are no more generic vregs. Verify // that the size of the now-constrained vreg is unchanged and that it has a // register class. @@ -161,6 +163,7 @@ } MRI.getVRegToType().clear(); +#endif if (!TPC.isGlobalISelAbortEnabled() && (Failed || MF.size() == NumBlocks)) { MF.getProperties().set(MachineFunctionProperties::Property::FailedISel);