diff options
author | Geoff Berry <gberry@codeaurora.org> | 2016-11-18 19:37:24 +0000 |
---|---|---|
committer | Geoff Berry <gberry@codeaurora.org> | 2016-11-18 19:37:24 +0000 |
commit | b51774ac8ca27bb4705a61754781382fadbd1f22 (patch) | |
tree | c083a2a54522a3753af638244397120680114faa /llvm/lib | |
parent | 2a3d10ae613af37491fd81747ec418d2d93635b0 (diff) | |
download | bcm5719-llvm-b51774ac8ca27bb4705a61754781382fadbd1f22.tar.gz bcm5719-llvm-b51774ac8ca27bb4705a61754781382fadbd1f22.zip |
[MIRPrinter] Print raw branch probabilities as expected by MIRParser
Fixes PR28751.
Reviewers: MatzeB, qcolombet
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D26775
llvm-svn: 287368
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MIRParser/MIParser.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/MIRPrinter.cpp | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp index 236b59121cf..1b611fbbe62 100644 --- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp +++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp @@ -488,7 +488,8 @@ bool MIParser::parseBasicBlockSuccessors(MachineBasicBlock &MBB) { lex(); unsigned Weight = 0; if (consumeIfPresent(MIToken::lparen)) { - if (Token.isNot(MIToken::IntegerLiteral)) + if (Token.isNot(MIToken::IntegerLiteral) && + Token.isNot(MIToken::HexLiteral)) return error("expected an integer literal after '('"); if (getUnsigned(Weight)) return true; diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp index 884defb9dbf..2b5c789605d 100644 --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -32,6 +32,7 @@ #include "llvm/IR/Module.h" #include "llvm/IR/ModuleSlotTracker.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/Support/Format.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/YAMLTraits.h" #include "llvm/Support/raw_ostream.h" @@ -481,7 +482,9 @@ void MIPrinter::print(const MachineBasicBlock &MBB) { OS << ", "; printMBBReference(**I); if (MBB.hasSuccessorProbabilities()) - OS << '(' << MBB.getSuccProbability(I) << ')'; + OS << '(' + << format("0x%08" PRIx32, MBB.getSuccProbability(I).getNumerator()) + << ')'; } OS << "\n"; HasLineAttributes = true; |