[llvm-mca] Strip leading tabs and spaces from instruction strings before printing. NFC
llvm-svn: 332361
diff --git a/llvm/tools/llvm-mca/InstructionInfoView.cpp b/llvm/tools/llvm-mca/InstructionInfoView.cpp
index 289ca03..76d63d2 100644
--- a/llvm/tools/llvm-mca/InstructionInfoView.cpp
+++ b/llvm/tools/llvm-mca/InstructionInfoView.cpp
@@ -25,11 +25,14 @@
const MCSchedModel &SM = STI.getSchedModel();
unsigned Instructions = Source.size();
+ std::string Instruction;
+ raw_string_ostream InstrStream(Instruction);
+
TempStream << "\n\nInstruction Info:\n";
TempStream << "[1]: #uOps\n[2]: Latency\n[3]: RThroughput\n"
<< "[4]: MayLoad\n[5]: MayStore\n[6]: HasSideEffects\n\n";
- TempStream << "[1] [2] [3] [4] [5] [6]\tInstructions:\n";
+ TempStream << "[1] [2] [3] [4] [5] [6] Instructions:\n";
for (unsigned I = 0, E = Instructions; I < E; ++I) {
const MCInst &Inst = Source.getMCInstFromIndex(I);
const MCInstrDesc &MCDesc = MCII.get(Inst.getOpcode());
@@ -65,8 +68,15 @@
TempStream << (MCDesc.mayLoad() ? " * " : " ");
TempStream << (MCDesc.mayStore() ? " * " : " ");
TempStream << (MCDesc.hasUnmodeledSideEffects() ? " * " : " ");
- MCIP.printInst(&Inst, TempStream, "", STI);
- TempStream << '\n';
+
+ MCIP.printInst(&Inst, InstrStream, "", STI);
+ InstrStream.flush();
+
+ // Consume any tabs or spaces at the beginning of the string.
+ StringRef Str(Instruction);
+ Str = Str.ltrim();
+ TempStream << " " << Str << '\n';
+ Instruction = "";
}
TempStream.flush();