When we have a terminator sequence (i.e. a tailcall or return), MIIsInTerminatorSequence is used to work out where the preceding ABI-setup instructions end, i.e. the parts that were glued to the terminator instruction. This allows LLVM to split blocks safely without having to worry about ABI stuff.
The function only ignores DBG_VALUE instructions, meaning that the two debug instructions I recently added can end terminator sequences early, causing various MachineVerifier errors. This patch promotes the test for debug instructions from "isDebugValue" to "isDebugInstr", thus avoiding any debug-info interfering with this function.
Unfortunately I don't have a test where I can replicate this: it would require getting ScheduleDAGSDNodes to emit debug instrs between a tail call and the instrs glued to it. This is happening on a large codebase (that I can't directly access) deep inside LTO, and this change fixes it. Hopefully everyone agrees: this is an obvious fix.
Should it be isMetaInstruction() ?