[PATCH] D66510: Fix for "DICompileUnit not listed in llvm.dbg.cu" verification error after cloning a function from a different module

Oleg Pliss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 11:58:49 PDT 2019


OlegPliss added inline comments.


================
Comment at: lib/Transforms/Utils/CloneModule.cpp:199
+          NewNMD->addOperand(MappedOperand);
+      }
+    } else
----------------
aprantl wrote:
> Should this be an insertCU helper function in DebugInfo.h?
If you mean insertCU(DICompileUnit*, SmallPtrSet&), it would only be called twice and would increase number of code lines in the project. The worst, it would not always be called for insertion of DI CUs to "llvm.dbg.cu". Often the code deals with generic operands of generic NMD.

What would really help is proper abstractions for different NMD kinds. The doc says NMD operands is a collection. In general a collection may contain duplicates and is not ordered (and so is not indexable). For "llvm.dbg.cu" and many others a set would be more desired. Here the duplicates just complicate debug info comparison, waste CPU cycles and consume some space in DWARF. Meanwhile `CloneModule` tries to preserve the operand ordering, and other functions do not. 


Repository:
  rL LLVM

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

https://reviews.llvm.org/D66510





More information about the llvm-commits mailing list