[PATCH] D36082: [Cloning] Move distinct GlobalVariable debug info metadata in CloneModule

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 22:30:02 PST 2018


rtereshin added inline comments.
Herald added a subscriber: JDevlieghere.


================
Comment at: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp:189
     for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
       NewNMD->addOperand(MapMetadata(NMD.getOperand(i), VMap));
   }
----------------
I'm hitting a case with an older version of LLVM I can't unfortunately expose as a test: this part of `CloneModule` while iterating over operands of `!llvm.dbg.cu`, which are `DICompileUnit`s, sometimes duplicates a `DICompileUnit`. Not always, strangely enough. The duplicate itself is completely redundant, but it also explicitly breaks the debug info as that CU doesn't get included into `llvm.dbg.cu` list. Adding `RF_MoveDistinctMDs` flag to this `MapMetadata` call solves the problem.

Do you think you could take a look and see if we need `RF_MoveDistinctMDs` here as well as above?


Repository:
  rL LLVM

https://reviews.llvm.org/D36082





More information about the llvm-commits mailing list