[PATCH] D26775: [MIRPrinter] Print raw branch probabilities as expected by MIRParser

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 11:25:15 PST 2016


MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.

Thanks, this will fix http://llvm.org/PR28751

LGTM with the points below addressed:



================
Comment at: include/llvm/Support/BranchProbability.h:73
   raw_ostream &print(raw_ostream &OS) const;
+  raw_ostream &printRaw(raw_ostream &OS) const;
 
----------------
I would lean towards just adding a `getRaw() const` function and leaving the printing to the MIRPrinter in the grounds that there is no matching `parseRaw()` function here as well.

The fact that the current code broke, is because the MIRPrinter was implemented with print() whose format changed in time, while the parse in MIParser stayed the same.


================
Comment at: lib/CodeGen/MIRPrinter.cpp:485
+        OS << '(';
+        MBB.getSuccProbability(I).printRaw(OS);
+        OS << ')';
----------------
I'd lean towards printing it in hex.


https://reviews.llvm.org/D26775





More information about the llvm-commits mailing list