[PATCH] D87063: [BitcodeReader] Fix O(N^2) in placeholder replacement algorithm.

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 22:39:33 PDT 2020


mehdi_amini added a comment.

I tried to review, but I'm too unfamiliar with this code at this point and won't have enough time to page-in the existing one and review the new one.



================
Comment at: llvm/lib/Bitcode/Reader/ValueList.cpp:160
+  // This is used later to ensure we process constants in the correct order.
+  DenseMap<Constant*, unsigned> NumRewrittenOperands;
+  SmallVector<Constant *, 64> RewriteWorklist;
----------------
Nit: can you run git clang-format?



================
Comment at: llvm/lib/Bitcode/Reader/ValueList.cpp:162
+  SmallVector<Constant *, 64> RewriteWorklist;
+  auto CountOperandsOfUsers = [&](Constant* C) {
+    for (Use &ConstantUse : C->uses()) {
----------------
I think this lambda could be documented, or alternatively maybe renamed: alone it does not "count" but "increment" users' count. 


================
Comment at: llvm/lib/Bitcode/Reader/ValueList.cpp:219
+    // Remap the constant's operands.
+    for (auto &Operand : C->operands()) {
+      Constant *OperandVal = cast<Constant>(Operand);
----------------
auto->Value ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87063/new/

https://reviews.llvm.org/D87063



More information about the llvm-commits mailing list