[PATCH] D44132: [MIR] Making MIR Printing, opt -dot-cfg, and -debug printing faster

Justin Bogner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 21 09:45:42 PDT 2018


bogner added a comment.

Still looks good - two very nitpicky style comments below for when you commit.



================
Comment at: lib/IR/AsmWriter.cpp:509
+  NumberedTypes.resize(Type2Number.size());
+  for (const auto P : Type2Number) {
+    assert(P.second < NumberedTypes.size() && "Didn't get a dense numbering?");
----------------
Better to spell this "const auto &P"


================
Comment at: lib/IR/AsmWriter.cpp:511
+    assert(P.second < NumberedTypes.size() && "Didn't get a dense numbering?");
+    assert(!NumberedTypes[P.second] && "Didn't get a unique numbering?");
+    NumberedTypes[P.second] = P.first;
----------------
I think you can avoid default constructing the item by using NumberedTypes.count(P.second) instead of operator[]. Of course, it really doesn't matter much in this case since the value's just an unsigned.


Repository:
  rL LLVM

https://reviews.llvm.org/D44132





More information about the llvm-commits mailing list