summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2017-12-15 18:13:05 +0000
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2017-12-15 18:13:05 +0000
commit22f0742dda8da93de7c6585c9129c81483346b68 (patch)
tree447cdc1d4ec6d628879defc049fc678c064a0faa /llvm/lib/CodeGen
parent5efd4d8b5e469f207a633bd4158bd7c3df41c084 (diff)
downloadbcm5719-llvm-22f0742dda8da93de7c6585c9129c81483346b68.tar.gz
bcm5719-llvm-22f0742dda8da93de7c6585c9129c81483346b68.zip
Fix for bug PR35549 - Repeated schedule comments.
Differential Revision: https://reviews.llvm.org/D40960 llvm-svn: 320837
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 20381e4c83f..294ea51969f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -722,7 +722,9 @@ void AsmPrinter::EmitFunctionEntryLabel() {
}
/// emitComments - Pretty-print comments for instructions.
-static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS,
+/// It returns true iff the sched comment was emitted.
+/// Otherwise it returns false.
+static bool emitComments(const MachineInstr &MI, raw_ostream &CommentOS,
AsmPrinter *AP) {
const MachineFunction *MF = MI.getMF();
const TargetInstrInfo *TII = MF->getSubtarget().getInstrInfo();
@@ -766,12 +768,16 @@ static void emitComments(const MachineInstr &MI, raw_ostream &CommentOS,
CommentOS << " Reload Reuse";
}
- if (Commented && AP->EnablePrintSchedInfo)
- // If any comment was added above and we need sched info comment then
- // add this new comment just after the above comment w/o "\n" between them.
- CommentOS << " " << MF->getSubtarget().getSchedInfoStr(MI) << "\n";
- else if (Commented)
+ if (Commented) {
+ if (AP->EnablePrintSchedInfo) {
+ // If any comment was added above and we need sched info comment then add
+ // this new comment just after the above comment w/o "\n" between them.
+ CommentOS << " " << MF->getSubtarget().getSchedInfoStr(MI) << "\n";
+ return true;
+ }
CommentOS << "\n";
+ }
+ return false;
}
/// emitImplicitDef - This method emits the specified machine instruction
@@ -1013,8 +1019,10 @@ void AsmPrinter::EmitFunctionBody() {
}
}
- if (isVerbose())
- emitComments(MI, OutStreamer->GetCommentOS(), this);
+ if (isVerbose() && emitComments(MI, OutStreamer->GetCommentOS(), this)) {
+ MachineInstr *MIP = const_cast<MachineInstr *>(&MI);
+ MIP->setAsmPrinterFlag(MachineInstr::NoSchedComment);
+ }
switch (MI.getOpcode()) {
case TargetOpcode::CFI_INSTRUCTION:
OpenPOWER on IntegriCloud