If factored out as a function accepting a DebugLoc rather than an llvm::Instruction, it may be mergable with most of printDebugLoc from lib/CodeGen/MachineInstr.cpp. The print format is not identical but I'm not sure if this is a problem. http://reviews.llvm.org/D3513