diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp index ed7ff83a3c6df..9abd408324c06 100644 --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZHLASMInstPrinter.cpp @@ -30,6 +30,16 @@ void SystemZHLASMInstPrinter::printInst(const MCInst *MI, uint64_t Address, StringRef Annot, const MCSubtargetInfo &STI, raw_ostream &O) { - printInstruction(MI, Address, O); + std::string Str; + raw_string_ostream RSO(Str); + printInstruction(MI, Address, RSO); + // Eat the first tab character and replace it with a space since it is + // hardcoded in AsmWriterEmitter::EmitPrintInstruction + // TODO: introduce a line prefix member to AsmWriter to avoid this problem + if (!Str.empty() && Str.front() == '\t') + O << " " << Str.substr(1, Str.length()); + else + O << Str; + printAnnotation(O, Annot); } diff --git a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td index 50f636a8d9686..6e136b10aed42 100644 --- a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td @@ -18,7 +18,8 @@ class InstSystemZ